Problem Description
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 <kbd>Up</kbd> prints "`^[[A`"
* pressing <kbd>Dn</kbd> prints "`^[[B`"
* pressing <kbd>Rt</kbd> prints "`^[[C`"
* pressing <kbd>Lt</kbd> prints "`^[[D`"

* How can this be avoided?
* Why does it print these 4 characters instead of moving the cursor?
AI-Generated Solution
Powered by LMSouq AI · GPT-4.1-mini
Analyzing problem and generating solution…
Was this solution helpful?