Re: fseek

From: Alan Balmer (albalmer_at_att.net)
Date: 11/12/03


Date: Wed, 12 Nov 2003 11:33:05 -0700

On 12 Nov 2003 17:27:25 GMT, Dan.Pop@cern.ch (Dan Pop) wrote:

>In <d8j4rvo967qj9ji44rdg02gsedred00kpo@4ax.com> Alan Balmer <albalmer@att.net> writes:
>
>>On 12 Nov 2003 13:26:55 GMT, Dan.Pop@cern.ch (Dan Pop) wrote:
>>
>>>>Which was exactly the point. There's more involved in seeking a text
>>>>stream than simply counting characters.
>>>
>>>And yet, you claim that you can use character offsets as arguments to a
>>>fseek call on a text stream.
>>
>>Of course you can. You can also use random numbers.
>
>The idea was to be able to seek to well defined positions inside the file.
>
>>I don't claim to
>>be able to portably relate the results to anything in particular.
>
>In general, the results of ftell on a binary stream are
>useless/meaningless to any text stream on the same implementation.
>
>The thing you don't get is that the encoding of the file position returned
>by ftell on a text stream need not be a plain byte offset. It could be
>a record number and a byte offset inside the record.
>
>Dan
Sorry to dispell your illusion of omniscience (do you fancy yourself a
telepath?), but you have no idea what I "get" and "don't get." I not
only "get" that possibility, I have designed storage systems using
similar methodology. What *you* don't "get" (or at least want to argue
about) is that any file may be opened in binary mode, and a character
offset generated by fseek/ftell. The standard does not preclude using
that offset in fseek on a text file. Obviously, as I stated
previously, the standard says nothing about the usefulness of doing
this. You say this is an "obvious bug" in the standard. I suggest you
submit it for correction.

-- 
Al Balmer
Balmer Consulting
removebalmerconsultingthis@att.net


Relevant Pages

  • Re: CR-NL, NL and ftell
    ... a program capable of both card and tape output ... > the keyboard was not part of standard C! ... from any input source: ... if you use a text stream to read the data back again: ...
    (comp.lang.c)
  • Re: Handling errors in standard output statements with openmcl (learner questions)
    ... stream variable you can use to get your error output, ... its value is #<Stream for Standard Input>. ... PATHNAME: NIL. ... its value is #<Stream for Standard Error>. ...
    (comp.lang.lisp)
  • Re: fread breaks file descriptors opened in "w" mode.
    ... stream, in which case it is not rewindable. ... except for that very fseek call. ... the fread returns 0 meaning that there was nothing to read: ... That's allowed by the standard. ...
    (comp.lang.c)
  • Re: Stream text/data to zip/gpg instead of passing app a filename?
    ... stream the text/data into gpg.exe to end up with the encrypted file ... accepts input from stdin, then you simply need to write to its stdin   ... Do those commands work when you type them into the command line? ... /// Reader thread for standard output ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Will reading from stdin() flush output to stdout()?
    ... > Regarding if a fflushof the standard output is needed or not. ... characters are intended to be ... > transmitted as a block to the host environment when a buffer is filled, ... > when input is requested on an unbuffered stream, ...
    (comp.lang.c)