This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: FILE I/O: fread() fails for GCC(Cygnus & DJ's) and TC++


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]