On Tue, Jan 07, 2003 at 10:44:52AM +0100, Jean-Marc Lasgouttes wrote: > Andre> The problem is, not to many people here have a Windows > Andre> development system to check. The ifstream in question is not > Andre> opened in binary mode as far as I can tell, so optically it > Andre> should work. Nevertheless, the '\r' show up for the Windows > Andre> people... > > How do we open in text/binary mode?
I _think_ text is default and one has to give the std::ios_base::binary flag explicitly otherwise. That's why I do not really understand how the '\r' can turn up at all unless it does not get eaten by this text/binary distinction. Under *nix there is no difference between binary and text at all, so I never used this before and consequently don't know what should happen (and when) > I guess you mean rtrim('\r'). Note that we may have a problem with > mac-style files (with a single \r for line end), so the best would be to > have a stream that just does the right thing. I can't believe that C++ > standards builders did not cater for this need. I think they did, and ofstream << '\n' would indeed create a ASCII 13 on Macs, 13/10 on Dos and 10 on *nix. Likewise I thought reading up to '\n' would reverse the process. *read CD2* I wonder what happens if we used getline(s,n,widen('\n')) I don't understand what is written there, though... Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)