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!

up dating a record in a binary file

Status
Not open for further replies.

magezi

Programmer
Mar 2, 2000
118
UG
Suppose I created a file and entered values in it; and then later I want to open this file,search for a value and if I find it make modifications and save the record again into the file thus over writting the previous values how can I implement this in c++
Nkabirwa Sowed Magezi
nkabirwa@yahoo.com

A Ugandan Developer for

(1) School Management Information System(SMIS) - Foxpro 2.6 ; Ms-Acess 97

(2)Debt onitoring System(DMS) - Ms-Acess 97

(3) The Loans Recovery System(LS) - Ms- Access 97

(4) The Dry Cleaners System(DS) - Ms- Access 97
 
You would do it just like in a text file.
Read the records from the file until you find the one you care about, modify it and dump the whole records set it in a second (temporary) file. After that, delete the old file and rename the new file to the deleted files name.
You could overwrite in the same file, but for that you have to be sure that the size of the data written is the same as the size of data deleted or else you may lose information. [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top