con.txt 和 C++
#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;
}
输出:
some text in con.txt
如果我将“con.txt
”替换为“something.txt
”,那么something.txt将包含字符串“some text in Something.txt。”
我认为文件 con.txt 与控制台文件绑定...第一种情况真实发生了什么?
#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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CON
是 Windows 平台上的保留设备名称。它不应该用作文件名,即使带有扩展名。来自文档:
CON
is a reserved device name on Windows platforms. It shouldn't be used as a file name, even with an extension.From the documentation: