Re: fseek
In <l6j4rvcu495gj0 a4cebt3btuo42v7 d1oq1@4ax.com> Alan Balmer <albalmer@att.n et> writes:
[color=blue]
>On 12 Nov 2003 13:25:17 GMT, Dan.Pop@cern.ch (Dan Pop) wrote:
>[color=green][color=darkred]
>>>7.19.9.2
>>>
>>>"For a text stream, either offset shall be zero, or offset shall be a
>>>value returned by an _earlier successful call to the ftell function on
>>>a stream associated with the same file_ and whence shall be SEEK_SET."
>>>
>>>Emphasis added.[/color]
>>
>>The other stream *must* be a text stream too. Connect a binary stream to
>>a text file and all the bets are off.[/color]
>
>Chapter and verse, please.[/color]
It's an obvious bug in the standard. Ask in comp.std.c if you don't
believe me.
Binary files and text files can have completely different internal
representations and the standard doesn't provide any guarantee about
what happens when you open a text file in binary mode or vice versa.
It only addresses the cases when a binary stream is attached to a binary
file and a text stream to a text file.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
In <l6j4rvcu495gj0 a4cebt3btuo42v7 d1oq1@4ax.com> Alan Balmer <albalmer@att.n et> writes:
[color=blue]
>On 12 Nov 2003 13:25:17 GMT, Dan.Pop@cern.ch (Dan Pop) wrote:
>[color=green][color=darkred]
>>>7.19.9.2
>>>
>>>"For a text stream, either offset shall be zero, or offset shall be a
>>>value returned by an _earlier successful call to the ftell function on
>>>a stream associated with the same file_ and whence shall be SEEK_SET."
>>>
>>>Emphasis added.[/color]
>>
>>The other stream *must* be a text stream too. Connect a binary stream to
>>a text file and all the bets are off.[/color]
>
>Chapter and verse, please.[/color]
It's an obvious bug in the standard. Ask in comp.std.c if you don't
believe me.
Binary files and text files can have completely different internal
representations and the standard doesn't provide any guarantee about
what happens when you open a text file in binary mode or vice versa.
It only addresses the cases when a binary stream is attached to a binary
file and a text stream to a text file.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
Comment