Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Exit Codes in DBC

Author
Message
ThinkDigital
19
Years of Service
User Offline
Joined: 18th Aug 2005
Location: A galaxy far, far away...
Posted: 24th Dec 2005 21:28
Is there anything that you can do to get the exit codes from a program that you execute from DBC?

-thanks


Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Dec 2005 22:10
Exit codes? Do you mean "exit prompt"?

This doesn't appear to work in Classic though.




ThinkDigital
19
Years of Service
User Offline
Joined: 18th Aug 2005
Location: A galaxy far, far away...
Posted: 24th Dec 2005 22:13
Exit codes: The codes a program returns before it exits after it's been executed. For instance, in Dark edit, the error from the DB compiler is returned.

Exit prompt is a dialog box that appears only in compiled EXEs.


re faze
20
Years of Service
User Offline
Joined: 24th Sep 2004
Location: The shores of hell.
Posted: 24th Dec 2005 22:29
pass it a pointer from the launching program and have it write data there prior to an exit?

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Dec 2005 22:31
Quote: "Exit codes: The codes a program returns before it exits after it's been executed. For instance, in Dark edit, the error from the DB compiler is returned."


I think most programs just write information to the clipboard so other programs/dlls can use that information. You can just write a file too (if it's for your own debugging)... or make a variable like Error$ and type "print Error$" when Darkbasic Classic goes to the CLI.

Quote: "Exit prompt is a dialog box that appears only in compiled EXEs."


Ah... that explains why it didn't work for me. When I test out Classic code I don't make a final .exe.


ThinkDigital
19
Years of Service
User Offline
Joined: 18th Aug 2005
Location: A galaxy far, far away...
Posted: 24th Dec 2005 22:36
I'm using the exit codes off a third party program. I've got no control over what it does. It sends the exit codes, which are not on the clipboard, and I can't get to them anyway I know using DBC. You can get the exit codes in Java and languages like that, but I can find no way to do it in DBC.


Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Dec 2005 22:40
What's the program?


ThinkDigital
19
Years of Service
User Offline
Joined: 18th Aug 2005
Location: A galaxy far, far away...
Posted: 24th Dec 2005 22:42
7-zip, command line version.


SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 24th Dec 2005 22:54 Edited at: 25th Dec 2005 02:41
Here are DBC's exit codes - enjoy (inside the snippet to keep post length down for those who already know how to find the error codes):

(I wouldn't expect it to crash out with 222 onwards)



...maybe one day I'll finish a project
ThinkDigital
19
Years of Service
User Offline
Joined: 18th Aug 2005
Location: A galaxy far, far away...
Posted: 25th Dec 2005 02:33
No (though that's useful), I need to get the exit codes from another program.


SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 25th Dec 2005 02:39
oh - you're meaning a program started within your program using 'execute file'? and when that program crashes, get your DB program to read it's crash data and output that in a more user-friendly form?

...maybe one day I'll finish a project
ThinkDigital
19
Years of Service
User Offline
Joined: 18th Aug 2005
Location: A galaxy far, far away...
Posted: 25th Dec 2005 03:20
Yes, like that.


master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 25th Dec 2005 07:57
Why do you need all of this? To make it so you can't exit? Like a virus? Duhn duhn duhhhhn

blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 25th Dec 2005 11:47
Quote: " Why do you need all of this? To make it so you can't exit? Like a virus? Duhn duhn duhhhhn"


7-zip is a really decent file compression tool, with the command-line version returning exit codes depending on if the file operation was successful. Wtf are you on about.

@thinkdigital: You may have to execute the file manually using a Windows API function or two; i'm pretty sure you can get the exit code then.

16-colour PNGs pwn.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Dec 2005 22:34
This may not be the most elegant way to do it but you can force the programs output into a file and read that files last few lines to see if it got an error. Just have it search for the word "Error" and the next line under it is the error.




master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 26th Dec 2005 05:36 Edited at: 27th Dec 2005 04:45
I was just joking about the whole concept of not being able to exit, not the "compression tool"

ThinkDigital
19
Years of Service
User Offline
Joined: 18th Aug 2005
Location: A galaxy far, far away...
Posted: 26th Dec 2005 19:58
Hmm, okay Grog, that would work. And is there any way to do it in DBPro (I just got DBPro)?


Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th Dec 2005 21:59
That should work in both Pro and Classic. It was actually written in Pro.


Login to post a reply

Server time is: 2025-05-22 19:25:01
Your offset time is: 2025-05-22 19:25:01