#include <stdio.h> #include <string.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #define MAX 2000000000 int main(int argc, char **argv) { int i=1; char x[30]; if (argc < 2) { exit(EXIT_FAILURE); } int fd = open(argv[1], O_WRONLY | O_APPEND | O_CREAT, 0666); while (1) { sprintf(x,"%d\n",i++); write(fd, x, strlen(x)); i%=MAX; usleep(200); } return 0; }