Hello,
I am trying to write a program that stores all of the names of textfiles in a current directory in a vector,once having the filenames I need to open each and disply all vaild e-mail addresses. At this time I have it getting all filenames and stroing them in a vector. I even have a test program that is reading files and displaying all valid addresses. However, when trying to put everything together,I am having problem with opening the files(names stored in array). I have a loop to go through the vector and read and store the filename to a variable and then use the traditonal ifstream to open the file but it isn't working.Below is just a sample program where I have strored filenames in the vector and trying to open the files.
for (unsigned n = 0; n < vec.size(); n++)
{
myfile.open( vec[ n ].c_str() );
...
}
The fstream constructors don't take std::strings, alas. That has bitten me enough that I know it now... but I always keep a good reference handy anyway.