Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cfile seek problem

Status
Not open for further replies.

Premalm

Programmer
Mar 20, 2002
164
US
Hi Guys,

Here is my code. I have 4 rows in a file. I have opened the file using CFILE Open and then I am using CArchive to ReadString from the file. When I do a SeektoBegin it should go to the top of the file and then when I do a ReadString it should read the first row. Instead it shows me the last row. I have tried using Seek but the same result. I want to move the file position as and when I want. Any suggestions ?

if(ArTempINDFile.ReadString(EntireStringA)==FALSE)
{
CheckingDups=FALSE;
break;
}
ArTempINDFile.ReadString(EntireStringA);
MessageBox(EntireStringA);
ArTempINDFile.ReadString(EntireStringA);
MessageBox(EntireStringA);

TempSortedFile.SeekToBegin();

ArTempINDFile.ReadString(EntireStringA);
MessageBox(EntireStringA);

Thanks
Premal

 
I have never looked into this subject but I will guess that the CArchive object maintains it’s own file postion and therefore is not effected by the CFile functions.

You might be using the CArchive object in a way that was not intended and therefore not supported.

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top