Monday, December 27, 2010

about my tests

I think I'm forgetting that FILE really is something goofy....

More tests needed. More tests, more tests.

If I say:

FILE *fp;

Then I'm saying that fp holds a memory address to something that is FILE. But what is FILE?

I know what int and char are, but what is FILE?

If type FILE is a structure (I'm certain it must be) then what is it, and what do fopen and fread do to its members?

*EDIT*

Yea, maybe I should just consider the FILE thing as a "it's helpful don't worry about it" sort of business.

http://en.allexperts.com/q/C-1587/2008/5/FILE-Structure.htm


*EDIT X2*

I think I figured it out. My assertion from a few posts ago was wrong:

"I'll need to restate obvious things to work through this. My file pointer, plxfilepointer, is a variable that contains a memory address. This memory address is a location in memory where my file is being held (to the best of my knowledge that's how fopen works)."

What it should says is that my file pointer, plxfilepointer, is a variable that contains a memory address to a structure of type FILE that has all kinds of things inside for the standard library of file manipulation functions to deal with. De-referencing plxfilepointer makes no sense without intimate knowledge of the members of the structure.

Even K&R says to not worry too much about it and just let the functions do their job.

Ok, I feel better.

No comments:

Post a Comment