Why would I ever open a file (std::ifstream) without std::ios::binary?

Viewed 1857

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

2 Answers
Related