Mail Archives: djgpp/1997/09/03/05:52:14
Orlando Andico (orly AT gibson DOT eee DOT upd DOT edu DOT ph) writes:
> 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.
And in C++, ios::binary in the streap initializing.
(What is ios::binary really? ios must be a class or something. Or maybe
it's an enum?)
--
.*. Where feelings are concerned, answers are rarely simple [GeneDeWeese]
-() < When I go to the theater, I always go straight to the "bag and mix"
`*' bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh
- Raw text -