Having trouble accessing members of a struct
I want to have multiple file instances open at a given time (probably only 5-10 at time at most). So one way I thought of doing it was to have a structure with the fstream instance and the filename (and any other information). Although, when I try and access the structure to set the contents, it gives me the error message: "m_fileio has not been declared". I haven't programmed in a while, so I'm a little out of touch. The error is quite self-explanatory, I'm just not sure why it says they aren't defined.
Structure Definition:
Code:
struct FILE_STRUCT
{
std::fstream m_fileio;
std::string m_filename;
};
Code for setting the members of the struct (p_file is a vector of FILE_STRUCT pointers):
Code:
p_file.push_back( new FILE_STRUCT );
( (p_file.end() )->m_fileio).open(filename.c_str());
( p_file.end() )->m_filename = filename;