I would like to remove an entry from a textfile.
My coding works fine with the reading portion from textfile, but I am stuck with the removing portion.
Below is my coding:
void OptionB :: DisplayCashFlow()
{
ifstream cashflow;
cashflow.open ("cashflow.txt");
string data;
while (! cashflow.eof())
{
getline(cashflow, data);
if (!cashflow.eof())
{
file.push_back(data);
}
}
cashflow.close();
string choice;
for(int i = 0; i < (int)file.size(); i++)
{
cout << i + 1 << ") " << file[i] << endl;
}
cout << "Enter which entry to remove" << endl;
cin >> choice;