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.

Dark GDK / Command-line, argc, argv (Help!)

Author
Message
Try
20
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 8th Sep 2007 14:13
I need to pass argc & argv to a function for its initialization, but I've no clue how to get them from DGDK...!

argc is an integer and argv is a pointer to a pointer, just like a normal entry-point/entry-function.

int main(int argc, char *argv[])
{
.
.
.
return 0;
}

Thanks for your help
-Try
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 8th Sep 2007 14:53
There's a function which is part of the DGDK library, called dbCl$

This returns a string of all of the command line arguments that are passed into your application. Also note that DGDK applications don't have a main function, hence the dbCl$ function when your DarkGDK function is called.

Paul.

Try
20
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 8th Sep 2007 16:34 Edited at: 8th Sep 2007 16:42
Well, I'm evaluating 'Trolltech Qt 4.3.1' for using in my editor (as GUI) which I'm writing in DGDK but I need the exact values as I showed in the pseudo code above!

I tried to fake them like this:



dbCl$ returns (*char) but I need (**char) (pointer-to-pointer) for using as array.

As you know (I'm sure) the 'argc' shows the number of arguments passed to the app and 'char *argv[]' holds the actuall parameters passed to the app...

I guess I'm doing something wrong... I'll check my project settings!

Anyone with any exprience with Qt? Anyone used it in DGDK before?

[EDIT] Qt is very powerful, you could check it out http://www.trolltech.com/products/qt [EDIT]

Cheers,
-Try
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Sep 2007 22:29
Your code doesn't produce an ANSI-spec argv array. There should always be an extra item at the end of the array set to NULL.


If you want to separate the arguments from dbCl$() then you'll need to write a parser for it. Windows uses a slightly odd setup for command-line escapes & quotes, so you can't use Linux/Unix source without changing it.

Here's the blog of a guy who's worked out what needs doing: http://vladimir_prus.blogspot.com/2004/07/windows-command-line.html

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
Try
20
Years of Service
User Offline
Joined: 16th Aug 2004
Location:
Posted: 9th Sep 2007 09:37
Quote: "There should always be an extra item at the end of the array set to NULL"

Ooops, forgot that!
Thanks Ian

Quote: "If you want to separate the arguments from dbCl$() then you'll need to write a parser for it."

Uuuuh, should have knew that...

I'll check the link when I got to home...

Cheers,
-Try

Login to post a reply

Server time is: 2024-10-08 22:20:10
Your offset time is: 2024-10-08 22:20:10