I can't get std::ios::nocreate to compile. The reason? Microsoft doesn't define it in their headers - except for in ios.h. I think its an oversite in their STL headers.
My guess is that you are using .h header files which automatically include all classes into the global namespace by using namespace std.
Using .h STL headers is an old-style approach. The prefered way is to use the non-.h headers:
Example:
instead of:
#include <fstream.h> #include <iostream.h> #include <string.h> [/source] use: [source]#include <fstream>#include <iostream> #include <string>
|
Something you'll notice immediately is that you now have to qualify all the STL classes with std::. You can no longer just write:
string mystring;
You must write:
std::string mystring;
Now to make things easier you can write:
using namespace std;
Then you don't have to qualify the STL classes with std:: anymore.
I hope this clarifies things a bit.
Dire Wolf
direwolf@digitalfiends.com
P.S. The reason why std::ios::nocreate compiles for you is because you are using the .h header files. As I stated, Microsoft has seemed to have left out this type in their ios header file.
Edited by - Dire.Wolf on December 15, 2000 12:00:59 PM