#define _POSIX_C_SOURCE 1 #include #include #include int main(int argc, char *argv[]) { FILE *entree = fdopen(strtol(argv[1], NULL, 10), "r"); FILE *sortie = fdopen(strtol(argv[2], NULL, 10), "w"); if (entree == NULL || sortie == NULL) { perror(NULL); exit(EXIT_FAILURE); } unsigned long n; fscanf(entree, "%lu", &n); while (true) { unsigned long i; fprintf(sortie, "%lu ", n); fflush(sortie); if (fscanf(entree, "%lu", &i) != 1) break; n += i; } return EXIT_SUCCESS; }