Page 1 of 1

Hybrid (GUI+CLI) application - PrintN

Posted: Tue Mar 10, 2015 11:04 pm
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

Re: Hybrid (GUI+CLI) application - PrintN

Posted: Fri Mar 13, 2015 9:31 am
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.

Re: Hybrid (GUI+CLI) application - PrintN

Posted: Sun Mar 15, 2015 12:14 am
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?

Re: Hybrid (GUI+CLI) application - PrintN

Posted: Fri May 15, 2015 9:35 am
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)