I thought I had this all working. I am trying to store 2 arrays of strings. 1) Persons name 2) Notes This is basically a homemade database of notes.
For somereason the notes don't load properly.
Please look at my code and see if you see a problem.
Code:
CFile PlayerFile;
CStringList m_Players;
CStringList m_Text;
if(PlayerFile.Open("playerinfo.dat",CFile::modeNoTruncate|CFile::modeReadWrite|CFile::shareExclusive,NULL))
{
CArchive ar(&PlayerFile, CArchive::load); // Load its contents into a CArchive
m_Players.Serialize(ar);
m_Text.Serialize(ar);
PlayerFile.Close();
}
pos=m_Players.FindIndex(j);
if( m_Players.GetAt(pos) == Player)
{
pos=m_Text.FindIndex(j);
TEXTLINE[i][0]=m_Text.GetAt(pos);
found=true;
break;
}
PlayerFile.Open("playerinfo.dat",CFile::modeCreate|CFile::modeReadWrite|CFile::shareExclusive,NULL);
PlayerFile.SeekToBegin();
CArchive ar (&PlayerFile, CArchive::store); // Load its contents into a CArchive
m_Players.Serialize(ar);
m_Text.Serialize(ar);
This is not everything, this is the load segment the read segment then the save segment. I hope this is enough, but I'll be happy to post more as needed.
This was working, with occasional corruption, but now it appears to be broken all together.
Thanks in advance for your help.