I want to delete a line of my text file without replacing it with " ". Just as a side note: my file has newlines. So I have more than one line (like a table)
void Data::delete_line(const string& idNr) {
ifstream list;
string readFile, id;
list.open("list.txt", ios::app);
if (list.is_open()) {
while (getline(list, readFile)) {
int pos = readFile.find(';');
id = readFile.substr(0, pos);
if (idNr == id) {
//deleting the line here
}
}
}
}
I found this question but it does not solve my problem: