2015-06-07 04:05:37 -04:00
|
|
|
#include <time.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
static int
|
|
|
|
process(char *name, struct timespec *ts)
|
|
|
|
{
|
2015-06-07 04:10:23 -04:00
|
|
|
FILE *file = fopen(name, "r");
|
2015-06-07 04:05:37 -04:00
|
|
|
|
2015-06-07 04:10:23 -04:00
|
|
|
if (file == 0){
|
|
|
|
fprintf(stderr, "[err] you either gave me an invalid file, or no file at all");
|
|
|
|
return -1;
|
|
|
|
}
|
2015-06-07 04:05:37 -04:00
|
|
|
|
2015-06-07 04:10:23 -04:00
|
|
|
int x;
|
|
|
|
while ((x = fgetc(file)) != EOF) {
|
|
|
|
printf("%c", x);
|
|
|
|
nanosleep(ts, NULL);
|
|
|
|
}
|
2015-06-07 04:05:37 -04:00
|
|
|
|
2015-06-07 04:10:23 -04:00
|
|
|
return 0;
|
2015-06-07 04:05:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2015-06-07 04:10:23 -04:00
|
|
|
char *argv0;
|
2015-06-07 04:05:37 -04:00
|
|
|
|
2015-06-07 04:10:23 -04:00
|
|
|
struct timespec ts;
|
|
|
|
ts.tv_sec = 0;
|
|
|
|
ts.tv_nsec = 10 * 1000000;
|
2015-06-07 04:05:37 -04:00
|
|
|
|
2015-06-07 04:10:23 -04:00
|
|
|
process(argv[1], &ts);
|
2015-06-07 04:05:37 -04:00
|
|
|
|
2015-06-07 04:10:23 -04:00
|
|
|
return 0;
|
2015-06-07 04:05:37 -04:00
|
|
|
}
|