toaruos/util/typewriter.c
2011-04-16 14:33:13 -05:00

19 lines
370 B
C

#define _XOPEN_SOURCE 500
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char ** argv) {
if (argc < 3) { return -1; }
FILE * f = fopen(argv[2],"r");
char * buffer = malloc(sizeof(char) * 1);
while (!feof(f)) {
fread(buffer, 1, 1, f);
printf("%c", buffer[0]);
fflush(stdout);
usleep(atoi(argv[1]));
}
fclose(f);
return 0;
}