Is it possible on Windows without using WinAPI?
+2
A:
No.
You can't without accessing the console's api that is never standard.
Klaim
2010-09-19 13:34:39
+6
A:
You may not remove last character.
But you can get the similar effect by overwriting the last character. For that, you need to move the console cursor backwards by outputting a '\b' (backspace) character like shown below.
#include<iostream>
using namespace std;
int main()
{
cout<<"Hi";
cout<<'\b'; //Cursor moves 1 position backwards
cout<<" "; //Overwrites letter 'i' with space
}
So the output would be
H
bjskishore123
2010-09-19 13:47:59
+1, I never knew this could work.
DeadMG
2010-09-19 13:54:13
You do have to be careful that cout doesn't decide to `flush` itself before the backspace has been inserted.
rubenvb
2010-09-19 16:47:48