I think you are mixing up a few things there. I'm not totally clear on what you want to do. But the best way is to either make a class that handles everything for you or just make an array of ifstreams without using a class.
To do it with a class you could do something like this:
Code:
class file_manager
{
public:
file_manager();
~file_manager();
bool open(char* name);
char* getline();
bool close();
private:
ifstream m_file;
};
Ofcourse you'll have to implement all the contents of those functions yourself but most of them will be just simply calling the members of ifstream.
To do it without a class you could do something like this:
Code:
ifstream filearray[50];
for( i=0 ; i < 50 ; i++)
{
filearray[i].open(filename[i]);
filearray[i].getline(buffer,256);
cout << "reading from file " << i
<< " data: " << buffer << endl;
}