Typical C language instruction doesn't work in the MCUXpresso IDE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Typical C language instruction doesn't work in the MCUXpresso IDE

Jump to solution
2,205 Views
Braun
Contributor II

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.

0 Kudos
1 Solution
2,194 Views
converse
Senior Contributor V

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 

View solution in original post

7 Replies
2,181 Views
nickwallis
Senior Contributor I

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

0 Kudos
2,160 Views
Braun
Contributor II

How to use "\033[2J" ? Should I use PRINTF("\033[2J" )?

But I tried PRINTF, it still does nothing to the terminal window.

0 Kudos
2,140 Views
converse
Senior Contributor V

These escape sequences only apply to ‘serial’ terminals, such as TeraTerm. It does not apply to the Eclipse (MCUXPRESSO) console.

0 Kudos
2,134 Views
Braun
Contributor II

If I use it in PuTTY, a serial terminal, should I use PRINTF("\033[2J" )?

0 Kudos
2,109 Views
Braun
Contributor II

It works, thanks a lot!

0 Kudos
2,195 Views
converse
Senior Contributor V

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