This is for the more experienced folks.
Recently I found that in Visual C++ 2010 (and 2012, not sure about earlier versions) one can use a std::string as the file name argument for the .open( ) function. I've always known the .open( ) function to take only char* (C-style) strings as the argument. Use of std::string would require the use of the .c_str( ) method.
Anyone have any idea when this showed up in VC++? And why MS doesn't seem to document it?
Example code
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main ()
{
string fname = "test.txt";
ifstream fin;
fin.open( fname ); //previously, this had to be: fin.open( fname.c_str( ) );
if( ! fin )
cout << "Error." << endl;
fin.close( );
return 0;
}