chpicker
Programmer
- Apr 10, 2001
- 1,316
I'm trying to learn the "proper" way to code to ANSI specifications which involves losing some habits. One of these is using the .h versions of standard header files. However, I've run into a problem which I can't figure out the solution to.
Here is a sample chunk of code. This is the "old way" of doing it:
This compiles fine. However, the following does not:
When I attempt to compile this code, I get the following error:
error C2039: 'nocreate' : is not a member of 'basic_ios<char,struct std::char_traits<char> >'
If I take out the reference to "nocreate" and leave "binary" in there, it compiles just fine.
Is "nocreate" changed to something else in the standard headers? Or is this a problem with the MS headers? I'm using Visual C++ 6.0 with SP4.
Ian
Here is a sample chunk of code. This is the "old way" of doing it:
Code:
#include <fstream.h>
void main() {
ifstream cInfile("c:\\myfile.bin",ios::nocreate|ios::binary);
}
Code:
#include <fstream>
using namespace std;
void main() {
ifstream cInfile("c:\\myfile.bin",ios::nocreate|ios::binary);
}
error C2039: 'nocreate' : is not a member of 'basic_ios<char,struct std::char_traits<char> >'
If I take out the reference to "nocreate" and leave "binary" in there, it compiles just fine.
Is "nocreate" changed to something else in the standard headers? Or is this a problem with the MS headers? I'm using Visual C++ 6.0 with SP4.
Ian