C++/fstream

Advertisement


Question
If I want to delete specified data in a saved file, without deleting the whole data in that file. how can I do that?
Ex:
nadia nadia 86
maha maha 203

if i want to delete "nadia nadia 86" only
how can I do it?

Answer
Hi,
  Try the following and let me know if it works !
  [1] Get the tell() of the start of the line to be deleted.
[2] Read the remaining lines following this line.
[3] Go back to the start of the line
[4] write down the data
[5] Put an end of file character.

Thanks,
RaiD

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Dharmender Rai

Expertise

I can answer general and system level C/C++ questions.

Experience

I have 5 years of experience in C++.

©2016 About.com. All rights reserved.