i have been trying to come up with a code that deletes data saved in a text file but to no avail. How should it be done?? in c++ this is my code how can i improve it so that it deletes saved data may be entry by entry?
#include<iostream>
#include<string>
#include<fstream>
#include<limits>
#include<conio.h>
using namespace std;
int main()
{
ofstream wysla;
wysla.open("wysla.txt", ios::app);
int kaput;
string s1,s2;
cout<<"Please select from the List below"<<endl;
cout<<"1.New entry"<<endl;
cout<<"2.View Previous Entries"<<endl;
cout<<"3.Delete an entry"<<endl;
cin>>kaput;
switch (kaput)
{
case 1:
cout<<"Dear diary,"<<endl;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
getline(cin,s1);
wysla<<s1;
wysla.close();
break;
}
return 0;
}