ios::nocreate error while compiling a C++ code
c++, g++, iostream, linux
Solution
`ios::nocreate` is not part of standard C++ - what are you expecting it to do?
Edit: From a Google, it seems like it was intended to prevent the file being created if it doesn't already exist. This is the default for ifstreams anyway, so you can just say:
ifstream f( filename );
if ( ! f.is_open() ) {
// open failed - probably because infput file does not exist
}
Problem
While, compiling a package, written in C++ on RHEL 5.0. I am getting the following error. > error: `nocreate` is not a member of `std::ios` The source-code corresponds to: ifstream tempStr(`argv[4]`,`ios::in`|`ios::nocreate`); I have tried #g++ -O -Wno-deprecated <file.cpp> -o <file> as well as: #g++ -O -o <file> Please suggest a solution.