This may apply to another part of Stack Exchange, but I donโt think so - .se programmers are more about other things.
Going to the question: there are things that you can do with std :: ios :: binary that you cannot do in text mode (for example, relative search), but I cannot find anything in text mode that you can't do it in binary mode - even reading a file as text, for example, standard :: GetLine ()
So why should I ever open text? How is a related question possible, why not open as a binary by default? Whose precedent violates?
EDIT Additional Information
Here is what made me ask:
I have a file that is created on a Windows system, i.e. line contours CR LF.
I open it with std::ifstream using the std::ios::binary flag
I scan the file with std::getline and get exactly the behavior I would expect - getline reads one line at a time.
System: Windows 7 Pro
Compiler: g ++ for MINGW32
c ++ fstream
medivh
source share