Why does (i|o)fstream take a const char* parameter for a file name?

The string part of the library was developed after streams, and nobody thought to make the obvious modifications.

It’s merely out of political and temporal reality that they never got around to this before shipping C++98, and nobody bothered bringing it up again because you could always solve it with .c_str().

C++0x fixes this (see 27.9.1.6).

Welcome to C++.

Leave a Comment