33 lines
625 B
C
33 lines
625 B
C
#include <string.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
#define RATE 50 // 2400 baud
|
|
int main(int argc, char **argv)
|
|
{
|
|
printf("%s", "\033[2J"); /* Clears the screen */
|
|
// char buffer[255];
|
|
//char *b = buffer;
|
|
//size_t bufsize = 255;
|
|
int count = 0;
|
|
char ch;
|
|
FILE *fp;
|
|
if (argc < 2) {
|
|
fprintf(stderr, "%s\n", "No input file");
|
|
return 1;
|
|
}
|
|
fp = fopen(argv[1], "r");
|
|
|
|
while (!feof(fp)) {
|
|
if ( count == RATE) {
|
|
sleep(1);
|
|
count = 0;
|
|
}
|
|
|
|
ch = getc(fp);
|
|
putchar(ch);
|
|
count++;
|
|
}
|
|
return 0;
|
|
}
|