• 0

Problems reading files in C++


Question

for (int i = 0; i < 200; ++ i)

{

TheFile = "C:\\Documents and Settings\\Administrator\\Desktop\\Signal\\" + m_Symbol + ".txt";

MyFile.open(TheFile.c_str());

if (MyFile.is_open() == true)

{

// about to get here, but I can't read what is in the file

if (!MyFile) cout << "We have a problem" << endl;

getline(line, MyFile);

}

MyFile.close();

}

I'm basically running this loop every second. So I'm trying to open and close 200 files every second. When a file is present I can get past the MyFile.is_open() part, but I can't read what is in the file. "we have a problem" always comes up. Would anyone have a clue as to what I'm doing wrong?

Thanks

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.