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

Inserting & deleting data in files

Status
Not open for further replies.

globos

Programmer
Nov 8, 2000
260
FR
Hi all, here is the problem :

I use the standards classes provided by fstream.h to do some stuffs on files. These stuffs are :
-inserting(at the beginning) data to a file
-deleting the inserted data

For the moment I have to re-create the file when I do the preceding operations i.e. to insert data I create a new file then I copy the data and the rest of the whole file.
This method is quite expansive, are there other issues?
It might be physically impossible.

--
Globos
 
ofstream xx("datafile");//creates a new file or destroy
//the containt of the old file
xx<<&quot;hello&quot;;//write to it
cc.close();//save file
Ion Filipski
1c.bmp


filipski@excite.com
 
Thank you for your quite response, but it does not solve my problem, what you gave me erase the file. I want to insert data(not destroy) anywhere in the file without having to do an entire copy of it.

Later, I would like to be able to delete the added data, the final goal is to do a little ofuscator on files. --
Globos
 
see fstream, it can open in all modes, add/readonly/write Ion Filipski
1c.bmp


filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top