Martin Jørgensen said:
That was my mistake...
Indeed.
But please don't think that errors don't get
corrected by other people in this newsgroup and that it therefore is an
absolute catastropy to write comments to other peoples posts.
Well, it's not an absolute catastrophe, no, but it does increase our
workload if people give incorrect advice, and of course there is always the
danger that the advice might slip through the net and go uncorrected.
This group is large enough for both (or all three of us).
And indeed for many more. Please don't misunderstand me. You are most
welcome in comp.lang.c, not least because you seem very capable of
listening, learning, and asking bright questions. We're counting on you to
become an expert so that we can all retire and leave all the questions for
you to answer.
But please do try to take a little more care, that's all. Let me put it this
way - your answer showed that you don't really understand the whole "file
pointer" idea, right? Now, I would be prepared to bet a carrot, or maybe
even a potato, that you /knew/ you didn't really understand it. Am I right?
It turns out that, by answering a question wrongly, you gained the
opportunity to learn a little about file pointers. So all's well that ends
well. But if you get this sneaky feeling that you don't really know what
you're talking about, it's better not to answer at all than to guess.
Trust me on this. I've been there, done that, got several T-shirts and scars
to prove it. I've learned that guessing how C works is not the best way to
help people. Once, quite a few years ago now, I even made the mistake of
saying "The Standard says that such-and-such is the case", because it
seemed obvious to me that it would say that, so I didn't feel it necessary
to go and look - and about eighteen trillion people all yelled "WHERE does
it say that?" So I went and looked - and looked, and looked, and looked,
and to my astonishment the Standard didn't say that at all! I had to
apologise for making an incorrect claim, and of course I felt a bit of a
fool. Don't make the same mistake.
I was thinking of some
FSEEK code I recently made where the file position can be incremented or
stored just as the OP had in mind
Sure, but it's the file /position/ that is modified, not the file pointer.
It is a significant distinction.
and I don't see anything wrong in
telling him that the line lengths vary and therefore he can't do what he
probably thought he could do.
That in itself is quite right, when carefully separated from your "file
pointer" advice.