Date: Fri, 29 Aug 1997 11:14:35 +0800 (GMT) From: Orlando Andico To: Adam W Lee cc: djgpp AT delorie DOT com Subject: Re: Problem with fstreams... In-Reply-To: <5trdmc$d79$2@news.sendit.nodak.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 25 Aug 1997, Adam W Lee wrote: > : it is more helpful to specify the exact problem and give the exact code > : that produces it. without that, all others can do is guess. > > : so, i am guessing that you are dealing with binary files, but opening > : them in text mode. if this is the case, then read the fstream docs on > : how to open the files in binary mode. > > I did specify the exact problem, it quits copying halfway through! And I > also provided source... Like I said, though, it works great under Unix. that's exactly it. unix treats all files as binary, but dos has a text or "cooked" mode, and binary mode. default is cooked mode. when dos sees a ^z character (ascii 26) it treats that as end-of-file and stops. you have to add a "b" to your fopen, e.g. fopen ("file", "rb") in order to get the binary behavior of unix under dos ("b" does nothing under unix). if you're using open() you have to pass it the O_BINARY flag. sorry if i repeat what someone else might have said, but i don't have your code fragment around so i can't see if you already did that. ------------------------------------------------------------------- Orlando Alcantara Andico WWW: http://www2.mozcom.com/~orly/ Email: orly AT mozcom DOT com ICBM: 14 30 00 N 120 59 00 E POTS: (+632) 932-2385