I have a text file into which I write first 10 characters the user inputs:
int x=0;
ofstream fout("out.txt");
while (x<=10)
{
char c=getch();
if (c==8)//check for backspace
fout<<'\b';
else
fout<<c;
x++;
}
Whenever the user presses backspace I want to delete the previously entered character from the text file.
I tried writing '\b'
to the file but it doesn't delete the last character.
How can I do so?
Thanks