You can call fflush on an input stream - it will cause a seek on the
filedescriptor associated with the stream to bring the file pointer in
line with stdio's file pointer, and the buffer associated with the
stream will be invalidated. You must flush input streams before forking;
if you don't, fclose (and therefore, exit) will have unexpected
side-effects.
Your mistake is probably that you called fflush(NULL), which only
affects output streams.
> Hmm how offtopic is this for linux-kernel?
Very. (You can use 'strace -f' to verify that the kernel is behaving
correctly.)
Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu