Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ios::nocreate..can't used in cl?

Status
Not open for further replies.

hughLg

Programmer
Feb 18, 2002
136
MY
I've just downloaded and installed Visual C++ Toolkit 2003, I found that every time I compile, I need to use "/EHsc" option. I've used the "/?" to get the help, but I still cannot understand what it for. I've the following code:
Code:
#include <fstream>
using namespace std;

int main() {
	ifstream f("data.txt", ios_base::in | ios_base::nocreate);
	return 0;
}
And I compile with "cl /EHsc test.cpp", but got the following error:
Code:
test.cpp(5) : error C2039: 'nocreate' : is not a member of 'std::ios_base'
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\xiosbase(181)
 : see declaration of 'std::ios_base'
test.cpp(5) : error C2065: 'nocreate' : undeclared identifier
test.cpp(5) : error C2676: binary '|' : 'const std::_Iosb<_Dummy>::_Openmode' do
es not define this operator or a conversion to a type acceptable to the predefin
ed operator
        with
        [
            _Dummy=int
        ]
 
ios::nocreate was in old stream library (<iostream.h> etc). No such openmode constant in modern C++ streams. Correct your source.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top