OpenConsole()

Syntax

Result = OpenConsole([Title$])
Description
Open a console window. This function must be called before any other function of this library. Only one console can be opened at the same time in a PureBasic program.

Parameters

Title$ (optional) The title for the new console window. On Windows, specifying a title allow the saving of custom console parameter, like font, color etc. It has no effect on other OS.

Return value

If Result is 0, it has failed and all further call to console functions must be disabled.

Remarks

The console can be closed using the CloseConsole() function.

With EnableGraphicalConsole() the console can be switched between text and graphics mode.

On Microsoft Windows, there are two different executable formats: Win32 and Console. If you want to create a standard console application, like 'dir', 'del' etc. you must compile the executable using the 'Console' format (Compiler Option menu in the PureBasic IDE). On Linux and OS X, there is no special Console format however setting the Compiler option to 'Console' will launch a terminal window automatically when you run your program from the IDE.

Example

  OpenConsole()
  PrintN("Waiting 5 secs before quit...")
  Delay(5000)

See Also

CloseConsole(), EnableGraphicalConsole()

Supported OS

All

<- Input() - Console Index - Print() ->