Problems with FindFirst() with fstream??

Can anybody help???
What i want to do is find a file with a .txt extension and read it with ifstream.

however i can never open it??? the code looks kindof like this

ifstream fin;
fin.open(file.cFileName);
if (!fin)
{
cout << "Could not open file for reading" << endl; //i like using endl
system("pause");
}

and of course i get the error message but if i execute this

FindNext(handle,&file)
cout << "File: " << file.cFileName << " Was found" << endl;

it will show me the correct file name.
i get no warnings from my "Borland" or "Dev-cpp" compiliers.


Since nobody answered your post, two hints:
(a) You can indicate that you have a question by a single '?'
(b) Your code contains, kindof, an error. However what kind of error it is requires detailed information, not some code which you considier similar to the one with the problem and the complete error messages. So post the code (best practice - that is, most likely leading to an usable answer - is to extract a minimal example containing the error which everyone can copy into one file and compile & execute for himself) and the error you get.
Topic archived. No new replies allowed.