Possible Duplicate:
ios::nocreate error while compiling a C++ code
i have been working on how to create a simple lexical compiler in c++/c# but it seems i have a an error when i try to compile the program the error is
error c2065 'nocreate' undeclared identifier
how can i handle this problem??but im thinking maybe it has to do with the fstream header,any ideas on how i can handle it??
this is the code where it is giving me an error
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);
ios::Nocreate
is not part of standard C++, but if the intention is to prevent the file being created if it doesn't already exist, you can relax. This is the default for ifstreams anyway, so you can just say:
fstream File("input.txt", ios::in);
If you are with VisualStudio, try
std::fstream File("input.txt", std::ios::in|std::ios::_Nocreate);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With