|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Problems with ifstream(by Reading out of Files)
Hi!
I want to save in Visual C++ with the fstream classes (ofstream, ifstream)!
I know that it is normal easy to save with helps of these commands, but I have a
problem by reading out of files (ifstream). But only by using data's from the
class CStringArray.
Here is my example code, where I have also my problem:
...
CStringArray m_aStringArrayTest;
m_aStringArrayTest.SetSize(100);
...
// now every Array get a String
// For example m_aStringArrayTest.SetAt(0, "Hello");
.............
// and now I want to save all
ofstream OutFile("test.txt");
for (i=0; i <=99; i++)
{
OutFile << m_aStringArrayTest[i];
}
OutFile.close();
Saving is possible but now I want to read the saved StringArrays and here I have
my problem, because my Compiler (Visual C++ 6.0) have a problem with >>, but
only than when I want to read a StringArray, by other Types like Integer, I get
no error!
My code with errors:
ifstream InFile;
InFile.open ("test.txt");
for (i=0; i <=99; i++)
{
InFile >> m_aStringArrayTest[i];
// With other types (like integer) it funktion
}
InFile.close();
It would be nice if someone can help me!
Thank you very much!
=================================================================
To SUBSCRIBE or UNSUBSCRIBE please visit
http://gameprogrammer.com/mailinglist.html
|
|