Hi all,
I want to read two files at two different steps in the same program using fstream.can anybody help me in this respect.
Because when i read characters using fstream.It gives me an error of "earlier declaration " of fstream.
thanxxxxxxx
Hi all,
I want to read two files at two different steps in the same program using fstream.can anybody help me in this respect.
Because when i read characters using fstream.It gives me an error of "earlier declaration " of fstream.
thanxxxxxxx
Please post (a portion of) your code. It's not particularly hard to have two files open and read from either as needed. You just have to have two different stream variables.
--
Mats
That sounds like you're doing something like:
fstream fs;
// do stuff with it ...
fstream fs;
// do more stuff with it
That's declaring the stream fs twice. What you want to do is fs.open() and fs.close(), I'd imagine.
Here's something to look at - http://www.cplusplus.com/reference/iostream/fstream/