FILE I/O: fread() fails for GCC(Cygnus & DJ's) and TC++
Sat Apr 26 07:33:00 GMT 1997
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
> creates a binary that quits halfway through the data(15 points
> 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
fopen mode from "r" to "rb" (for binary) and your program/data will work
correctly on both DOS and *NIX systems.
William Greathouse | firstname.lastname@example.org Email
SMV America, Engineering | email@example.com Email
8380 Darrow Road | (216) 425-1340 x4006 Voice
Twinsburg, OH 44087 | (216) 405-7684 FAX
More information about the Cygwin