Pointers to wifstream
I'm handling pointers, and can't access some member functions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
class Class {
void readFromFile(wifstream* file) {
// this works...
wstring name;
*file >> name;
// this doesn't...
while (*file.good()) {
// stuff happens...
}
}
int main() {
wifstream file("text.txt", ios::in);
Class instance;
instance.readFromFile(&file);
return 0;
}
|
either do like this:
(*file).good()
or like this
file->good()
Topic archived. No new replies allowed.