【发布时间】:2012-11-13 10:13:25
【问题描述】:
我一直在研究如何在 c++/c# 中创建一个简单的词法编译器,但是当我尝试编译程序时似乎出现了错误
error c2065 'nocreate' undeclared identifier
我该如何处理这个问题??但我想它可能与 fstream 标头有关,关于我如何处理它的任何想法??
这是它给我一个错误的代码
loadTransitionTable( );
fstream File("input.txt", ios::in|ios::Nocreate);
if (!File)
{
cout<<"\n Unable to open the input file."<<endl;
cout<<"\n Press any key to exit.";
getch( );
exit(0);
【问题讨论】:
-
可能是因为没有
nocreate标志?如果您使用ios::in(如果默认为ifstream)打开,则不会创建不存在的文件。