views:

215

answers:

3

In my codes, fprintf return successful by returning the number of bytes written in STREAM, but in the actual file the string I put is not there.

+3  A: 

The output is probably just buffered. Try closing the file using close() or call fflush() on the stream to force the string to the file.

Harry
A: 

one thing you haven't mentioned is have you done the flush() on the stream? although it should happen at the moment you're closing the stream.

and the other - you say "in the actual file the string is not there". do you mean you have nothing written in the file, or you have some junk written there? can it be a difference between the ascii and binary stream being used in your case?

zappan
A: 

yup close() and fflush() is my problem. thanks alot!

sasayins