#include #include #include #include #include main() { int x,y,z; int handle; int size,oldsize; FILE *output; char buf[20000]; handle = open("/tmp/flatmsg.txt",O_RDONLY); oldsize = lseek(handle,0,2); close(handle); while(1) { handle = open("/tmp/flatmsg.txt",O_RDONLY); size = lseek(handle,0,2); if(size > oldsize) { lseek(handle,oldsize,0); x = read(handle,buf,19990); buf[x] = 0; output = fopen("/tmp/temptext.txt","w+"); fprintf(output,"%s",buf); fclose(output); system("/usr/local/bin/playtext"); oldsize=size; } close(handle); sleep(1); } }