I have redirected stdout to a file in C.
This file is being opened/closed at several points of execution.
Only during one particular flow of execution, when I open the file junk characters are written before the first statement is written to the file.
I am wondering if file pointer is corrupted or file buffer has junk at the beginning.
I am using freopen function call.
Please let me know how to track this problem.
Is there a way to purge the file buffer without writing to the file?
I see fpurge in linux but HP-UX I am using doesnt seem to support this.