OpenConsole() issue

Linux specific forum
User avatar
DarkRookie
User
User
Posts: 20
Joined: Wed Nov 24, 2010 5:47 pm

OpenConsole() issue

Post by DarkRookie »

I am running 4.51 x64 on Mint 10
The OpenConsole() doesn't open anything. Am I missing something?
It is better to have a dumb question than a wrong answer!
User avatar
idle
Always Here
Always Here
Posts: 5836
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: OpenConsole() issue

Post by idle »

Did you set the executable format to console in compiler options.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
DarkRookie
User
User
Posts: 20
Joined: Wed Nov 24, 2010 5:47 pm

Re: OpenConsole() issue

Post by DarkRookie »

Nope. Didn't know that option was there. Used to Windows
Thanks for the fix.
It is better to have a dumb question than a wrong answer!
Robynsveil
User
User
Posts: 44
Joined: Fri Nov 30, 2012 2:07 pm

Re: OpenConsole() issue

Post by Robynsveil »

Setting Executable format to console has made no difference: nothing shows up. No dialogue, no nothing.

Why is this so difficult? I'm trying to execute this code from the Willloughby book:

Code: Select all

If OpenConsole()
  PrintN("1. Official PureBasic Home")
  PrintN("2. Official PureBasic Forums")
  PrintN("3. PureArea.net")
  PrintN("")
  PrintN("Enter a number from 1 To 3 and press Return: ")
  Destination.s = Input()
  Select Destination
    Case "1"
      RunProgram("http://www.purebasic.com")
    Case "2"
      RunProgram("http://forums.purebasic.com")
    Case "3"
      RunProgram("http://www.purearea.net")
    EndSelect
  EndIf
End
...and bugger-all happens. Am I the only one who is actually using Linux in Purebasic?
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: OpenConsole() issue

Post by freak »

OpenConsole() opens the channel for console output. If you run the compiled program inside a terminal you will see the console output.

Unlike on Windows, the 'console window' on linux is really an external program (a terminal emulator) in which you must run your program in order to see the output. You cannot start it from inside your program.

Btw, please don't repost the same question in many different topics. You won't get better answers that way. One topic is enough.
quidquid Latine dictum sit altum videtur
Robynsveil
User
User
Posts: 44
Joined: Fri Nov 30, 2012 2:07 pm

Re: OpenConsole() issue

Post by Robynsveil »

freak wrote:OpenConsole() opens the channel for console output. If you run the compiled program inside a terminal you will see the console output.

Unlike on Windows, the 'console window' on linux is really an external program (a terminal emulator) in which you must run your program in order to see the output. You cannot start it from inside your program.

Btw, please don't repost the same question in many different topics. You won't get better answers that way. One topic is enough.
Thanks for that, Freak. I've been working with this for the past 6 hours without any answer on the threads nor any clue in the documentation... thank goodness Fred pointed out to me where I was going wrong.

So, that tutorial by Gary Willoughby is useful only to Windows users, then. He failed to mention that. I guess he thought that no need to include any other than Windows users, really... Gotcha. Thanks for the heads-up. :)
Jacobite
User
User
Posts: 16
Joined: Fri Nov 30, 2012 7:21 pm

Re: OpenConsole() issue

Post by Jacobite »

In the manual it says:
On Linux and OS X, this command has no effect, as there is no special 'Console' format.
But after setting compiler options to "console", the console example program "console.pb" ran just fine. The console was launched from the IDE, although it was a smaller window than my xterm settings give when launching a console in the "normal" way. I'm using Xubuntu 12.04.
Post Reply