I have created a file(file.dat) and have written the following 3 lines.Later i want to delete the second line in the following way-but this is not happening. When i open the file some garbage is being shown and i see no lines which was written at the starting.May i know where i am wrong?
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");
}