Connecting Tech Pros Worldwide Forums | Help | Site Map

(part 32) Han from China answers your C questions

George Orwell
Guest
 
Posts: n/a
#1: Nov 20 '08
File Seeking / Overwriting bytes

Martien Verbruggen said:
Quote:
I don't think SEEK_END, which I assume you'd use to position at the end,
is supported on text streams.
And this is, of course, also not right. fseek() does support
SEEK_END on text streams.

If you want to know why, please start a thread on comp.lang.c.
Also, you could read "(part 18) Han from China answers your C questions".

But if you post to comp.lang.c, beware of noise from people who don't
really know the subject well enough, but feel they have to comment
anyway.

Yours,
Han from China

Il mittente di questo messaggio|The sender address of this
non corrisponde ad un utente |message is not related to a real
reale ma all'indirizzo fittizio|person but to a fake address of an
di un sistema anonimizzatore |anonymous system
Per maggiori informazioni |For more info
https://www.mixmaster.it

Richard Heathfield
Guest
 
Posts: n/a
#2: Nov 20 '08

re: (part 32) Han from China answers your C questions


George Orwell said:
Quote:
File Seeking / Overwriting bytes
>
Martien Verbruggen said:
Quote:
>I don't think SEEK_END, which I assume you'd use to position at the end,
>is supported on text streams.
>
And this is, of course, also not right.
True enough.
Quote:
fseek() does support SEEK_END on text streams.
Only partly. You can use SEEK_END to get to the end of a text stream (so
yes, you *can* position at the end), but you can't use it to get N bytes
from the end for N != 0. See 4.9.9.2 of C89.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Closed Thread


Similar C / C++ bytes