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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random Access File

Status
Not open for further replies.

Kendel

Programmer
Apr 24, 2002
1,512
US
Hi,

When I create a file, add some records to it, and then open it to read, I always lost the last record. If I manually open that text file, I can all the rcords are there, including the last record.

If I create the file, add some records to it, terminate thr program, then re-run and open it, all the record are there, including the last one.

Can anyone tell me what i am missind here?

I create the for writing with "w+b" mode. Add some records. And then open in "r+b" mode to read.

Thanks a bunch.
-kendel
 
Remember also to close the file in the end... The information is not written to disk al at once (imagine what would happed if you had a loop doing 1024 milion writes each of 1 byte) but data is stored in buffers that are written when filled - the moment of writing the buffers is OS dependant... [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Thanks. It must be something else. I did close the file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top