Guest_imported
New member
- Jan 1, 1970
- 0
Hello all,
I'm a beginner w/ C++ so please bear with me. I am creating a file to which I have to do frequent i/o (it's an index).
I thought that I should do this:
fstream fs;
fs.open(filename, ios::in|ios:
ut|ios::binary);
but I find that I get fs.good() == 0 unless I omit the ios::in. When I have
fstream fs;
fs.open(filename, ios:
ut|ios::binary);
I can write to, but not read from the file properly. Should I even be able to, considering that the stream is not being opened for input? How can I get around this? (I tried opening and closing the stream in the different modes, ios::in or ios:
ut, depending on what I needed, but that doesn't seem to work).
TIA for any insight you can give!
I'm a beginner w/ C++ so please bear with me. I am creating a file to which I have to do frequent i/o (it's an index).
I thought that I should do this:
fstream fs;
fs.open(filename, ios::in|ios:
but I find that I get fs.good() == 0 unless I omit the ios::in. When I have
fstream fs;
fs.open(filename, ios:
I can write to, but not read from the file properly. Should I even be able to, considering that the stream is not being opened for input? How can I get around this? (I tried opening and closing the stream in the different modes, ios::in or ios:
TIA for any insight you can give!