2015-06-07 04:05:37 -04:00
|
|
|
#include <time.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2015-06-07 17:09:03 -04:00
|
|
|
static int process(char *name);
|
2015-06-07 04:54:52 -04:00
|
|
|
|
2015-06-07 04:05:37 -04:00
|
|
|
static int
|
2015-06-07 17:09:03 -04:00
|
|
|
process(char *name)
|
2015-06-07 04:05:37 -04:00
|
|
|
{
|
2015-06-07 04:10:23 -04:00
|
|
|
FILE *file = fopen(name, "r");
|
2015-06-07 17:09:03 -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
|
|
|
if (file == 0){
|
2015-06-07 17:09:03 -04:00
|
|
|
fprintf(stderr, "[err] you either gave me an invalid file, or no file at all\n");
|
2015-06-07 04:54:52 -04:00
|
|
|
return -1;
|
2015-06-07 04:10:23 -04:00
|
|
|
}
|
2015-06-07 04:05:37 -04:00
|
|
|
|
2015-06-07 04:10:23 -04:00
|
|
|
int x;
|
|
|
|
while ((x = fgetc(file)) != EOF) {
|
2015-06-07 04:54:52 -04:00
|
|
|
printf("%c", x);
|
2015-06-07 17:09:03 -04:00
|
|
|
nanosleep(&ts, NULL);
|
2015-06-07 04:10:23 -04:00
|
|
|
}
|
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 17:09:03 -04:00
|
|
|
process(argv[1]);
|
2015-06-07 04:10:23 -04:00
|
|
|
return 0;
|
2015-06-07 17:09:03 -04:00
|
|
|
}
|