Subject: fread, fseek and ftell vs. _read and _lseek
From: [email-masked] (Earnie Boyd)

18 Jun 1998 19:42:52 -0700
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="-2131475428-832100416-898182762=:22141"
To: gw32 <[email-masked]>

---2131475428-832100416-898182762=:22141
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Based on the documentation from M$ and the sample program I've attached; it is my opinion that fread and fseek should not be used for "text mode" files.  Instead, use _read and _lseek.

With fread when a ^Z is encountered the file pointer is left indeterminate and so is the data it was reading when the EOF error occured.

With _read, the file pointer will be left intact and the data is returned including the ^Z.  You can then use _lseek to seek to the character past the EOF ^Z marker, ( e.g.: _lseek( fh, 1L, SEEK_CUR ); ) and then continue reading.

You will find attached testseek.c and testseek.dat which demonstrate this.
==
-        \\||//
---o0O0--Earnie--0O0o----
[email-masked]
------ooo0O--O0ooo-------

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

---2131475428-832100416-898182762=:22141
Content-Type: application/x-unknown-content-type-fma000_vim; name="testseek.c"
Content-Transfer-Encoding: base64
Content-Description: testseek.c
Content-Disposition: vi; filename="testseek.c"

---2131475428-832100416-898182762=:22141
Content-Type: application/x-unknown-content-type-txtfile; name="testseek.dat"
Content-Transfer-Encoding: base64
Content-Description: testseek.dat
Content-Disposition: attachment; filename="testseek.dat"

---2131475428-832100416-898182762=:22141--
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".