#include <fstream>
int _tmain(int argc, _TCHAR* argv[])
{
std::ofstream F("con.txt", std::ios::out);
F << "some text in con.txt";
F.close();
return 0;
}
output:
some text in con.txt
If i replace “con.txt” with “something.txt” then something.txt will contains the string “some text in something.txt.”
I think that the file con.txt bind with a console file… What is real happened in the first case?
CONis a reserved device name on Windows platforms. It shouldn’t be used as a file name, even with an extension.From the documentation: