Id like to edit a file. At first i thought this was going to be easy, but now it appears quite complex. As i understand it there is no standard way to delete part of a file?

im storing data on different lines in the file, and want to target a specific line to delete or edit. Ive read a bit about ios::ate, but dont know if this is the right direction, or if i should be copying the file, rebuilding it and inserting the data i want to at the right point.

Has anyone got any advice? thanks :)

You are correct in saying that you cannot actually delete a part of file.
So here is what you usually do.
Suppose you want to delete everything from the 57th byte to 64th byte:
--You first copy the first 56th bytes to a temp file
--Then you copy the 65th to last byte to the same temp file.
--You delete the main file
--You rename the temp file to the same name as main file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.