I've written a tiny program in Ansi C on Windows first, and I compiled it on Ubuntu with the built-in GCC now.
The program is simple:
- read the line from console with
scanf()
. - Analyze the string and calculate.
But something weird happens. When I try to move the cursor, it prints four characters:
- pressing Up prints "
^[[A
" - pressing Dn prints "
^[[B
" - pressing Rt prints "
^[[C
" - pressing Lt prints "
^[[D
"
How can this be avoided?
Why does it print these 4 characters instead of moving the cursor?