Mail Archives: djgpp/2000/08/25/10:01:45
Why is it, that people always suspect compiler bugs in
DJGPP, when in fact their own code is buggy? Very buggy in
this case. Have you tried this on another compiler?
"Rafał Maj" <r_maj AT poczta DOT onet DOT pl> wrote:
>I think ther is bug in I/O binary mode :
>
>1)
>I can't open ofstream / ifstream in ios::binary mode.
>When I use :
> ifstream plik; plik.open("test.txt",ios::binary); plik<<"OK ;)";
>plik.close();
>then test.txt is empty. When I don't use ios::binary, then everything is OK.
When you don't use ios::binary, the default flag for
ifstream.open() is set: ios::in. When you provide your own
flags you also have to provide that default flag:
plik.open ("test.txt", ios::binary|ios::in);
If you are opening a file in binary mode, keep your hands
off operator<<. Use read and write instead.
>2) Functions write / read from class ifstream/ofstream, with should be
>always binary, are working like in text mode (changing some chars, I think
>it was #13 -> #10 #13 or somethink like this)
I don't quite understand this one. How did you make them do
anything, using the code above?
>QUESTION :
>Where I can download new version of DJGPP that don't have this bug,
>or how can I do workaround of this bug ?
>
No comment.
--
Manni
"Life would be much easier if I had the source code."
- Raw text -