Thanks but getline() sets bits too so you still need to clear it.
"A call to this function may set any of the internal state flags of is if:"
flag
error
Type: Posts; User: Ducky
Thanks but getline() sets bits too so you still need to clear it.
"A call to this function may set any of the internal state flags of is if:"
flag
error
Ok, thanks for the explanation.
I understand now that there is this new concept of "error control state condition" with fstream that doesnt exist with fopen() and CreateFile().
Apparently it works...
Well you can do it with fopen() and Win32 API CreateFile() so it's definitely a miss from Mr Bjarne Stroustrup.
Ah, but I so wanted to use C++... ;-)
Yeah, but you changed the code, you closed it and reopened it again.
I want it to be opened in read & write mode and stay open and get the size from time to time.
We can't do that in C++ ?
Ah, thank you.
But even if I change it to seekp and tellp it returns -1.
Apparently I do both so how to get the size of the file?
tellg() won't return the size of the file, it returns -1.
What is the reason for it?
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
fstream file;