This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: FILE I/O: fread() fails for GCC(Cygnus & DJ's) and TC++
- To: Rich Kucera <Rich dot Kucera at ccmail dot irs dot gov>
- Subject: Re: FILE I/O: fread() fails for GCC(Cygnus & DJ's) and TC++
- From: William Greathouse <wgreathouse at smva dot com>
- Date: Sat, 26 Apr 1997 10:26:07 -0400
- >Received: from iago by mailserv.smva.com (AIX 3.2/UCB 5.64/4.03) id AA30654; Sat, 26 Apr 1997 10:26:15 -0400
- Cc: gnu-win32 at cygnus dot com
- Organization: SMV America, Engineering R&D
- References: <0009386C.1950@ccmail.irs.gov>
Rich Kucera wrote:
> On Linux & MPRAS, the sample program listed below manages to
> read through all thirty POINT structures with no problems.
>
> The program won't port however, because it appears that
> any DOS-based (FAT?) compiler (Cygnus GCC & DJ's GCC and Turbo
> C),
> creates a binary that quits halfway through the data(15 points
> read).
>
> I'm probably missing something about file I/O, or it
> could be some low-level file I/O problem. I don't know, help.
And that is your answer... On a DOS system there is a distinction
between "text" and
"binary" mode files that is not evident in the *NIX world. You need to
change your
fopen mode from "r" to "rb" (for binary) and your program/data will work
together
correctly on both DOS and *NIX systems.
Bill
--
William Greathouse | wgreathouse@smva.com Email
SMV America, Engineering | wgg@netcom.com Email
8380 Darrow Road | (216) 425-1340 x4006 Voice
Twinsburg, OH 44087 | (216) 405-7684 FAX
begin:vcard
fn:William Greathouse
n:Greathouse;William
org:SMV America Engineering
adr:8380 Darrow Road;;;Twinsburg;OH;44087;
email;internet:wgreathouse@smva.com
title:Senior Engineer
tel;work:(216) 425-1340 x4006
tel;fax:(216) 405-7684
x-mozilla-cpt:;0
x-mozilla-html:FALSE
end:vcard