I'm trying to read a global istream* using the following code:
/*Global Declaration*/
istream* fp;
/* in main */
ifstream iFile;
if(argc == 2)
//open file code
fp = &file;
else
fp = &cin;
readFile;
/*readFile*/
readFile(){
string line;
while(fp.getline(line))
cout<<line<<endl;
}
I'm getting the following error code:
"request for member getline
in fp
, which is of non-class type `std::istream*'
Could anyone tell me what the error is, and if there's a better way to go about it? I did try getline(fp, line) but had more errors there too.