Newsgroups: comp.os.msdos.djgpp From: manni DOT heumann AT gmx DOT de (Manni Heumann) Subject: Re: binary I/O bug ? References: <8o1930$36j$1 AT info DOT cyf-kr DOT edu DOT pl> X-Newsreader: News Xpress 2.01 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Thu, 24 Aug 2000 08:20:31 GMT NNTP-Posting-Host: dhcp33-228.uni-bielefeld.de Message-ID: <39a4dac9$1_1@news.uni-bielefeld.de> X-Trace: 24 Aug 2000 10:20:25 +0200, dhcp33-228.uni-bielefeld.de Lines: 45 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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" 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."