This may properly belong to a different part of Stack Exchange but I don't think so - programmers.se is more about other things.
Getting to the question: There are things you can do with std::ios::binary that you cannot do in text mode (E.g. relative seek) but I cannot find anything to do in text mode that you cannot do in binary mode - even reading the file as text with e.g. std::getline()
So why would I ever open as text? As a perhaps-related question, why not open as binary by default? Whose use-case does that break?
EDIT Additional information
Here's what's causing me to ask:
I have a file which is created on a windows system - that is, the line-endings are CR LF.
I am opening it with std::ifstream using the std::ios::binary flag
I am parsing through the file with std::getline and getting exactly the behavior I would expect - getline reads one line at a time.
System: Windows 7 Pro
Compiler: g++ for MINGW32
\r\nit will be read as\n. So code that uses the default and expects to see\nwould be broken. It will instead see\r\n. So for example you could end up with a trailing\ron a value read from the file, because removing\nno longer removes the whole linebreak sequence. It will fail to match the equivalent value without the erroneous\rfrom some other source. - Steve Jessop\r, you're almost entirely sure that no valid code exists that would not work when it sees\r? I don't think the follows ;-) Or do you mean you don't believe that opening a file that contains\rin binary mode will result in the code seeing the\rcharacters? That's easily confirmed with a few lines of test code. - Steve Jessop'\r'did cause me extra work. - James Kanze