free_console

Definition: free_console()
Description: Free (delete) any console window associated with your program.
Comments: Phix will create a console text window for your program the first time that your program prints something to the screen, reads something from the keyboard, or in some way needs a console (similar to a DOS-prompt window).
On Windows this window will automatically disappear when your program terminates, but you can call free_console() to make it disappear sooner.
On Linux, the text mode console is always there, but an xterm window will disappear after phix issues a "Press Enter" prompt at the end of execution.

On Linux, free_console() will set the terminal parameters back to normal, undoing the effect that curses has on the screen.

In a Linux xterm window, a call to free_console(), without any further printing to the screen or reading from the keyboard, will eliminate the "Press Enter" prompt that phix normally issues at the end of execution.

After freeing the console window, you can create a new console window by printing something to the screen, or simply calling clear_screen(), position() or any other routine that needs a console.

When you use the trace facility, or when your program has an error, phix automatically creates a console window to display trace information, error messages etc.

There is a Windows API routine, FreeConsole() that does something similar to free_console(). You should use free_console(), because it lets the interpreter know that there is no longer a console.
See Also: clear_screen