How can i delete a line from a file created using a C++ program?Can i get a code sample please? I am in desperate need of it!!!
I need it because i am writing a dbms project where i need to delete a line from a dat file. I have done the following but its not working!!I have posted it earlier but i did not get any sure answer. Please help!!!!
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream fout("file.dat",ios::out);
fout << "Sunanda 5 \n";
fout << "Rahool 10 \n";
fout << "Sunetra 12 \n";
fout.close();
ofstream fapp("file.dat",ios::out);
fapp.seekp(23);
int i = 0;
while(i < 11)
{
fapp << '\b';
i++;
}
fapp.close();
system("pause");
}