Hybrid (GUI+CLI) application - PrintN

Linux specific forum
broozar
User
User
Posts: 61
Joined: Sat May 08, 2010 11:21 pm
Location: Berlin, Germany

Hybrid (GUI+CLI) application - PrintN

Post by broozar »

hi all,

i am making a GUI application, however I would also like to use PrintN() to send additional information to the console in case someone starts the application through the terminal.

Every time I debug-run this from the editor, i get an error at the first PrintN(): "No console is currently opened." When I compile the application and run it outside the editor, it seems to work though. So my question are these:
- Is it legitimate to use PrintN() without OpenConsole()? Will it fail silently, or will it bring the application to a halt?
- Is there something like IsConsoleOpen() - a call that checks whether PrintN() can be executed without fail?

cheers
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Hybrid (GUI+CLI) application - PrintN

Post by Fred »

OpenConsole() on linux doesn't really open a console, just put it at your start of your code and it will be fine.
broozar
User
User
Posts: 61
Joined: Sat May 08, 2010 11:21 pm
Location: Berlin, Germany

Re: Hybrid (GUI+CLI) application - PrintN

Post by broozar »

Will do, thanks for the reply! Does OpenConsole() behave differently if i choose "Linux" or "Console" from the Compiler Options menu? It seems to me that neither setting opens a new console window, but prints to the one that is already open in case the binary has been started from a terminal, is that correct?
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Hybrid (GUI+CLI) application - PrintN

Post by Fred »

No, it behaves the same. The only difference is how the IDE handle your program startup (it will automatically open a terminal when "console" is selected)
Post Reply