J
JSonic
Good Morning mates.
Hope I can solve a little issue here.
Im stuck trying to build a script. I want it to open a file, read it,
them at the end, my script keep monitoring that file. Its a binary
file /dev/dsp. That file is receiving data from one mic plugged in my
lap.
So far so good. The only thing is when my script gets the EOF it
closes and I want it to still monitoring the file.
Is there any way to do it?
That¶ my script:
#include<stdio.h>
main () {
FILE *p;
char str[20], c;
printf("Arquivo: ");
gets(str);
p = fopen(str, "rb");
while(!feof(p)) {
fscanf(p, "%c", &c);
printf("%c", c);
}
fclose(p);
return 0;
}
P.s. All the data is been added at the end of the file, there's no
modification in the file content, so shouldn't be difficult.
Tks a lot!
Hope I can solve a little issue here.
Im stuck trying to build a script. I want it to open a file, read it,
them at the end, my script keep monitoring that file. Its a binary
file /dev/dsp. That file is receiving data from one mic plugged in my
lap.
So far so good. The only thing is when my script gets the EOF it
closes and I want it to still monitoring the file.
Is there any way to do it?
That¶ my script:
#include<stdio.h>
main () {
FILE *p;
char str[20], c;
printf("Arquivo: ");
gets(str);
p = fopen(str, "rb");
while(!feof(p)) {
fscanf(p, "%c", &c);
printf("%c", c);
}
fclose(p);
return 0;
}
P.s. All the data is been added at the end of the file, there's no
modification in the file content, so shouldn't be difficult.
Tks a lot!