Developpement/23DEV1.1/TPS1/TP2/controle/CM2_2022/3Ralenti.c

26 lines
467 B
C

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
int main() {
const char* mot = "ERREUR";
struct timespec attente;
int i;
attente.tv_sec = 0;
attente.tv_nsec = 500000000;
for (i = 0; i < strlen(mot); i++) {
putchar(mot[i]);
fflush(stdout);
if (nanosleep(&attente, NULL) == -1) {
perror("nanosleep");
return 1;
}
}
putchar('\n');
return 0;
}