How do I see, or what is an OpenConsole

Just starting out? Need help? Post your questions and find answers here.
c128/64basicyes
New User
New User
Posts: 9
Joined: Thu Jun 25, 2020 11:11 pm

How do I see, or what is an OpenConsole

Post by c128/64basicyes »

how do i get an openconsole(), i have been trying for days have an console appear, and have something printed on it and have NEVER had a console appear, i don't know what they are referring to, I assume that a console is a window on the screen with something printed in it!

1 If OpenConsole ()
2 EnableGraphicalConsole (1)
3
4 For i = 0 To 200
5 ConsoleLocate ( Random (79) , Random (24) )
6 Print ("*")
7 Next
8
9 ConsoleLocate (30 , 10)
10 PrintN (" Press return to exit ")
11 Input ()
12 EndIf
infratec
Always Here
Always Here
Posts: 7619
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: How do I see, or what is an OpenConsole

Post by infratec »

A console is a 'DOS-Box' like if you run cmd.

If I run your progrom in the IDE it shows a console window.
If you create an exe, you have to change the Executable-Format in Compiler Options
to Console.

You don't put the line numbers in the code :?:
And you should use the code tags to show your code like

Code: Select all

EnableExplicit

Define i.i

If OpenConsole ()
  EnableGraphicalConsole (1)
  
  For i = 0 To 200
    ConsoleLocate ( Random (79) , Random (24) )
    Print ("*")
  Next
  
  ConsoleLocate (30 , 10)
  PrintN (" Press return to exit ")
  Input ()
  
  CloseConsole()
EndIf
User avatar
NicTheQuick
Addict
Addict
Posts: 1520
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: How do I see, or what is an OpenConsole

Post by NicTheQuick »

On Linux you always have to choose the executable format "Console" in the compiler options if you want to see a console window.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
c128/64basicyes
New User
New User
Posts: 9
Joined: Thu Jun 25, 2020 11:11 pm

Re: How do I see, or what is an OpenConsole

Post by c128/64basicyes »

NicTheQuick wrote:On Linux you always have to choose the executable format "Console" in the compiler options if you want to see a console window.
i am still trying to learn system, what is

Enableexplicit

define i.i

it is not in the example of code that was presented to me

I still cannot get an openconsole i don't know what i am doing wrong i don't have those compiler options or again i am doing something wrong
infratec
Always Here
Always Here
Posts: 7619
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: How do I see, or what is an OpenConsole

Post by infratec »

Do you use PureBasic :wink:

Every version of PureBasic has these compiler settings, at least since I'm using PureBasic.

So please tell us your OS and your version of PureBasic, before we only speculate about something.

Btw.:

Place the cursor on the word EnableExplicit and press F1 (in the IDE of course)
c128/64basicyes
New User
New User
Posts: 9
Joined: Thu Jun 25, 2020 11:11 pm

settings

Post by c128/64basicyes »

OS is Windows 10 Pro

PureBasic version is 5.72
Olli
Addict
Addict
Posts: 1240
Joined: Wed May 27, 2020 12:26 pm

Re: How do I see, or what is an OpenConsole

Post by Olli »

EnableExplicit means that all the variables you create, must be created explicitly by the directive Define else an error occurs.
This prevents you to search a bug during many hours, in a big program, just because you forget to type a character.

It is very important, and I advise you to use it too !

Define just tells the compiler you create a variable.

Code: Select all

EnableExplicit ; this will tell me if I do a mistake
Define x, y, z    ; x, y and z are 3 new variables
Define a
Define b
Define c ; a, b and c are 3 new variables too
"Define" is like the old basic statement named "let".
infratec
Always Here
Always Here
Posts: 7619
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: settings

Post by infratec »

c128/64basicyes wrote:OS is Windows 10 Pro
PureBasic version is 5.72
So if you press F5 the program should start and you should see the console window.

Or ... the exexutable is blocked by a VirusScanner
c128/64basicyes
New User
New User
Posts: 9
Joined: Thu Jun 25, 2020 11:11 pm

hooray

Post by c128/64basicyes »

took mcafee off, reinstalled and it runs

Anything else anyone should tell me?
User avatar
Kiffi
Addict
Addict
Posts: 1503
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: hooray

Post by Kiffi »

c128/64basicyes wrote:Anything else anyone should tell me?
yes: good luck and have fun! :D
Hygge
AMpos
Enthusiast
Enthusiast
Posts: 128
Joined: Fri Jun 05, 2020 12:47 am

Re: How do I see, or what is an OpenConsole

Post by AMpos »

You can try

DEBUG "text"

to see your program output (it will open the Debug Window with the text "text" in it)

If you are doing a Windows Program, you should openwindow() for your output.

If you are planning to do a Game, openscreen() is your friend.

If you are planning to do a program to run in the background or just for testing, openconsole() may help you, as it is very similar to old computers output. It should be used only by very begginners or very advanced programmers.
Post Reply