Having a bit of trouble making my program work.
I am trying to get a stream that I can assign to either cin or an ifstream.
My idea was this...
However, I get erros when doing this that all the constructors and assignment operators for istream are "private within this context". I'm not qute sure what that means, but it won't let me use it later on.Code:istream inputstream; inputstream = cin; if (whatever) { inFile = ifstream("myfile.txt", ios::in); inputstream = inFile; }
Does anyone have experience with this kind of thing?
Also, it needs to be a stream, not a file pointer, so freopen() won't work.
I need a stream so I can apply transform() on it.
thanks if you can help me.



LinkBack URL
About LinkBacks


