Mail Archives: djgpp/1997/12/28/13:16:45
Steve Patton wrote:
>
> I am making an archive program, that uses (has nothing to do with the
> problem, but is using Allegro Compression Routines). And here's what I do.
>
[.:.]
> of course that's a snippet, with (hopefully) all you need to know. It works
> with the first file, perfectly. However, when it gets to the second, or
> more file, read does not read (or at least return) the correct size. Such
> as the second file, it only says it read 690 bytes or so, when it's about
> 55,000 bytes, and then the next read returns 0, as if it were at the end of
> file. The error (which is odd), I switched all read calls, with _dos_read
> calls (which should be compatible, since they are handle operated), and it
> works just fine. How come "read" doesn't work correctly? Who would I
> report this error too?
In DOS you must add O_BINARY to the open call. Otherwise, it'll
change all occurences of CR/LF to LF on read and vice versa on
write. And (and this is your problem) it terminates when
it hits a Ctrl-Z.
BTW, this code looks like C++, so once your at it, why not use
the stream functions? Although this is just aesthetic and you'll
hit the same problem there (and maybe others...)
--
Ciao
Tom
*************************************************************
* Thomas Demmer *
* Lehrstuhl fuer Stroemungsmechanik *
* Ruhr-Uni-Bochum *
* Universitaetsstr. 150 *
* D-44780 Bochum *
* Tel: +49 234 700 6434 *
* Fax: +49 234 709 4162 *
* http://www.lstm.ruhr-uni-bochum.de/~demmer *
*************************************************************
- Raw text -