From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: read reads too less under DOS but enough under linux Date: Tue, 08 Apr 1997 10:54:01 -0700 Organization: Two pounds of chaos and a pinch of salt Lines: 24 Message-ID: <334A8639.6204@cs.com> References: <5iehc6$ajo AT narses DOT hrz DOT tu-chemnitz DOT de> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp107.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Sven G. wrote: > > At first I new to C. But I hope its not my fault. > I wrote a simple program unter gcc/linux which runs ok. Then I compiled it with > DJGPP V2 under MS-DOS but the prg made nonsense. > As I debugged it, I saw that read (off a file) returned 0x3D instead of 0x40. > It was in the middle of the file, and how I said it worked under linux. > Maybe I did not considerated something I did not know. DOS text files use a CR/LF combination to designate the end of a line, while Unix text files use only a CR. Thus, DOS text files are larger than the corresponding Unix file. For this reason, you should NEVER open a text file in binary mode. There are utilities in the DJGPP distribution called 'dtou' and 'utod' that can convert between DOS and Unix style text files. -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com | | God's final message to His Creation: | http://www.cs.com/fighteer | | "We apologize for the inconvenience."| Fight against proprietary | | - Douglas Adams | software - support the FSF!| ---------------------------------------------------------------------