Page 1 of 2
Dos "Hello World" Crash [ No I'm not insanie ]
Posted: Sat May 17, 2003 2:20 pm
by Inner
Compile as a "/Console" application
Open MS-Dos window, execute the resulting executable.
And
"Unhandled exception in bumprev.exe: 0xC0000094: Integer Divide by Zero"
004015AB mov si,word ptr ds:[40306Ah]
004015B2 mov ax,[0040306C]
004015B8 mov cx,word ptr ds:[403066h]
004015BF mul ax,cx
004015C2 add ax,si
004015C5 add ax,di
>>>>004015C8 div al,cl
004015CA mov [0040306C],al
004015CF mov byte ptr ds:[40306Ah],ah
004015D5 push dword ptr ds:[40306Ah]
004015DB push dword ptr ds:[403062h]
004015E1 call 00401A60
004015E6 pop esi
x86 Asm means gibberish to me, 64k asm well I'd have a chance with that, but I guess someone would know what all that means, came from MS-VC++ 6.0
Posted: Sat May 17, 2003 2:43 pm
by Henrik
Hi Inner
Did you use OpenConsole() and CloseConsole()
Edited:
Hmm. Sorry better show an Example.
Code: Select all
If OpenConsole()
PrintN("Hello World ")
PrintN("")
Print("Press return to exit the World!")
Input()
CloseConsole()
EndIf
End
Bedst Regards
Henrik.
Posted: Sat May 17, 2003 2:44 pm
by WolfgangS
Try to open a console at first ... [;)]
Code: Select all
OpenConsole()
printn("Hello World")
delay(5000) ; wait 5 sec.
This was also one of my first postings in this forum 1 1/2 years ago
MFG
WolfgangS
Posted: Sat May 17, 2003 2:49 pm
by Inner
Erm, no a Dos Application needs not consoleopen() command since the dos window is already opened by, CMD or command.com depending on which version of windows you have.
the printn("Hello World") should there for look like;
C:\>runme.exe
Hello World
C:\>
And not open a new window.
Posted: Sat May 17, 2003 2:51 pm
by Henrik
Inner wrote:Erm, no a Dos Application needs not consoleopen() command since the dos window is already opened by, CMD or command.com depending on which version of windows you have.
the printn("Hello World") should there for look like;
C:\>runme.exe
Hello World
C:\>
And not open a new window.
It Dose'nt open a new window if you run it from the the Prompt C:\runme.exe.
An output of my example from the ms-dos prompt
Code: Select all
Microsoft(R) Windows 98
(C)Copyright Microsoft Corp 1981-1999.
C:\WINDOWS>cd..
C:\>cd programmer
C:\Programmer>cd..
C:\>cd pbtest
C:\PBTEST>ex.exe
C:\PBTEST>ex.exe
Hello World
Press return to exit the World!
C:\PBTEST>
Posted: Sat May 17, 2003 3:04 pm
by freak
Yes, OpenConsole() is always needed, even if executed from the Command prompt. PB will automatically use the allready open console,
if executed from the command prompt.
OpenConsole() is needed to intialize the Output stuff i guess.
Timo
BTW: I moved this to 'Beginners' as it is no Bug.
Posted: Sat May 17, 2003 3:05 pm
by Inner
Now, why is it.. that the more I code the more I think program has less to do with logic and more to do with how much of an illegal substant you've devowed.

not that I do such things but still.
here was therefor my logic;
Window is already opened, no need to open a console in a console since the console is there already, and if it wasn't windows would figure I wanted a console window because this is a dos application and open the console window itself.

note to self, edit the PureBasic docs, to reflect this.

all that ramblering, thanks both of you... 8O still think openconsole shouldn't be there but it works.

17 years of programming to be move to the beginniners forum !!! AAAHHH

Posted: Sat May 17, 2003 3:59 pm
by Inner
Code: Select all
OpenConsole()
PrintN("Hello World")
PrintN("Hello World") ; << CRASHES HERE
PrintN("Hello World")
PrintN("Hello World")
PrintN("Hello World")
CloseConsole()
So there is a bug after all.
Posted: Sat May 17, 2003 4:49 pm
by Henrik
Hi Inner
Not on win98 se.. What's your Os ?
Resoult of Your Exampel:
Code: Select all
Microsoft(R) Windows 98
(C)Copyright Microsoft Corp 1981-1999.
C:\WINDOWS>cd..
C:\>cd pbtest
C:\PBTEST>inner.exe
Hello World
Hello World
Hello World
Hello World
Hello World
C:\PBTEST>
Bedst Regards
Henrik.
Posted: Sat May 17, 2003 4:53 pm
by freak
Hmm, also no crash here...
(Win2k Sp3 PB3.62)
> 17 years of programming to be move to the beginniners forum !!! AAAHHH
Timo
Posted: Sat May 17, 2003 4:54 pm
by Inner
Windows XP
Posted: Sat May 17, 2003 7:11 pm
by DominiqueB
hello inner,
by default, the compiler compiles to windows prog.
Did you check the compiler's otions to select it to console option ?
I use xp too, and if console d=selected the prog works well.
If the windows output is selected, a console window is quickly opend and then closed.
No crash at all... ?
Have a test.
Dominique
Posted: Sat May 17, 2003 9:06 pm
by Manolo
Hi,
XP dont have DOS window. M$ or Billy the Kid$ forgot this implementation.
If you have one program in MS-DOS and want run in XP, please see the old mannuals of the beginers of Unix nad think in one daemon implementation.
XP is the more great "merde" from M$.
Manolo
Posted: Sat May 17, 2003 10:01 pm
by ricardo
Inner wrote:Code: Select all
OpenConsole()
PrintN("Hello World")
PrintN("Hello World") ; << CRASHES HERE
PrintN("Hello World")
PrintN("Hello World")
PrintN("Hello World")
CloseConsole()
So there is a bug after all.
XP here, run your code with a bat file and there is no problem.
Run it by doubleclicking the executable and no problem too.
Run it from the IDE and no problem...
How did you tried to run it?
I think that you forget to compile it as console application
Posted: Sun May 18, 2003 1:18 am
by Inner
Uhmm okay, weirder and weirder.
"C:\Program Files\PureBasic\Compilers\pbcompiler.exe" bumprev.pb /CONSOLE /EXE D:\IT\Code\PureBasic\bumprev\bumprev.exe
bumprev.exe -o foo -f bam -x furbar x y z
that is the batch file I am using to compile the application.
I don't use the IDE that comes with PB, I use ultraedit.
Manolo : yes I know slip of the (er?) type, it's called CMD these days, while I asume is called CommandLine.
There is however one thing I've noticed diferent from mine to yours, I have commandline arguments where as you do not.
Okay.... so I reboot my computer after being asleep for the night, and it works again.. now I am even more confused, okay 10mins later it happend again, closed the console down, and started a new console and ran it, it worked fine, me thinks something isn't being freed. you may have to compile run a few times to get the crash.