You have no protection against buffer overrun of your arrays.
I was thinking of
while(fgets(buff,sizeof(buff),fd) != NULL) {
if ( strstr(buff,"------") != NULL ) break;
}
i = 0;
Type: Posts; User: Salem
You have no protection against buffer overrun of your arrays.
I was thinking of
while(fgets(buff,sizeof(buff),fd) != NULL) {
if ( strstr(buff,"------") != NULL ) break;
}
i = 0;
Look at my example again.
You've still got fgets() inside fgets()
Which means you're sometimes reading two lines at a time.
> if(ps)
The problem is, after you find your magic marker, you only read ONE more line and that's it.
You need two while loops
// find the marker
while ( fgets( ) ) {
// found...