Sunday, December 26, 2010

Come on, fread.

I can't get ahead in my program because I can't make fread perform as advertised.

Behold:

"Upon returning, fread sets the file pointer in the stream pointing to the byte past the last byte that has been read. "

This does not appear to be happening. My file pointer never gets offset after fread sucks in some data. This is very irritating because I don't want to have to do any more bookkeeping than necessary about how far into the file I am.

I'm going to have to strip down my program and tease out the behavior. My original thought was that fread was adding an offset to my local variable file pointer, instead of the one in main. Some cleverly placed printf statements for all concerned file pointers pre and post fread show that nothing is changed.

I have one other hunch that will be confirmed with a really simple program, but that will have to wait until later.

No comments:

Post a Comment