"debut TD0"

This commit is contained in:
JunkJumper
2020-09-04 10:27:13 +02:00
parent ac93b9b2af
commit cf00c53e65
88 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
///************************************************/
///* imprimer : Ce programme illustre le principe */
///* du partage de temps de LINUX ... */
/**************************************************/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <assert.h>
void imprimer (int unNombre, char unCar)
{
int i;
for (i=0; i<unNombre; i++) printf ("%c", unCar);
}
int main(int argc, char *argv[])
{
int nb, res;
assert (argc == 2);
nb = atoi (argv[1]);
res = fork();
if (res == -1)
{
perror ("fork");
exit (1);
}
if (res == 0)
{
imprimer (nb, '/');
return 0;
}
else
{
imprimer (nb, '*');
return 0;
}
}