I want to clear the console desk so I use the system("CLS") in stdlib.h. I run it in the normal compilation environment, the instruction works. But when I run it in my LPC812, it seems like that the system("CLS") was ignored. It didn't clear the desk. The programm doesn't have any errors or warnnings, and the stdlib.h is included in the redlib.
I want to know are there any other solutions to fix the problem.
thanks.
Solved! Go to Solution.
system("CLS") is not a 'typical C language instruction to clear the screen. It is specific to the Windows terminal. As far as I know, there is no way to programmatically clear the console in MCUXpresso.
Details:
CLS is a Windows command line program. The program does not even exist in Linux, for example (In Linux, it is known as 'clear')
the C function system("string") finds and executes a shell command. If you check the return value from system, in your example, I suspect that it will return an error code
You can clear the screen of a terminal window (e.g. teraterm) by sending this control sequence to it : "\033[2J" will clear the screen followed by "\033[H" will move the cursor to the upper left corner. There are also other sequences for deleting text, moving the cursor, hiding the cursor and changing the text color etc......
-Nick
How to use "\033[2J" ? Should I use PRINTF("\033[2J" )?
But I tried PRINTF, it still does nothing to the terminal window.
These escape sequences only apply to ‘serial’ terminals, such as TeraTerm. It does not apply to the Eclipse (MCUXPRESSO) console.
If I use it in PuTTY, a serial terminal, should I use PRINTF("\033[2J" )?
It works, thanks a lot!
system("CLS") is not a 'typical C language instruction to clear the screen. It is specific to the Windows terminal. As far as I know, there is no way to programmatically clear the console in MCUXpresso.
Details:
CLS is a Windows command line program. The program does not even exist in Linux, for example (In Linux, it is known as 'clear')
the C function system("string") finds and executes a shell command. If you check the return value from system, in your example, I suspect that it will return an error code