delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/11/20:15:16

From: Jack Klein <jackklein AT spamcop DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: read() also broken
Message-ID: <jeppktoca7rk7s5rpv0p3n0sc20bmh57ek@4ax.com>
References: <Pine DOT GSO DOT 4 DOT 33 DOT 0107111652110 DOT 4160-100000 AT brahms>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Lines: 23
Date: Wed, 11 Jul 2001 23:50:03 GMT
NNTP-Posting-Host: 12.84.2.210
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc06-news.ops.worldnet.att.net 994895403 12.84.2.210 (Wed, 11 Jul 2001 23:50:03 GMT)
NNTP-Posting-Date: Wed, 11 Jul 2001 23:50:03 GMT
Organization: AT&T Worldnet
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Wed, 11 Jul 2001 16:53:25 -0500 (CDT), Jeff Bastian
<bastian AT hc DOT ti DOT com> wrote in comp.os.msdos.djgpp:

> 
> I just modified my code to use read() instead of fread() as a work-around,
> but read() demonstrates the same problem of skipping over the 0x0d
> character.

Change your program back to using fread(), which is standard,
portable, and guaranteed to be available on every C and C++ compiler
in the known and unknown world.

Then open files for binary input/output in binary mode, that is "rb"
instead of "r" and "wb" instead of "w", for the mode argument to
fopen().

-- 
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019