0

A question about esc character "\033[2J" ?

I am a c++ new learner by myself. I met a question of using \033. My code is below as #include <iostream> #include <string> using namespace std; #define DELAY 10000000L #define CLS (cout << "\033[2J") #define LOCATE(z, s) (cout << "\033[" << z << ';' << s << 'H') int main() { // int x = 2, y = 2, dx = 1, speed = 0; // string floor(80, '-'), header = "**** JUMPING BALL ****"; // cout << floor << endl; CLS << endl; LOCATE(1, 25) << endl; return 0; } output is ?[2J ?[1;25H \033[2J can not clear the screen and show ?[2J. My PC is Win10 and mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0. Thanks your help very much!

1st May 2019, 12:18 PM
Lawrence Lin
Lawrence Lin - avatar
1 ответ
+ 2
I my opinion, win 10 doesnt support ansi escape sequences. You can include 'windows.h' and use system("cls"); instead👍
4th May 2019, 12:24 PM
LetterC67
LetterC67 - avatar