English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. Language (https://eab.abime.net/forumdisplay.php?f=114)
-   -   [E] argc, argv example (https://eab.abime.net/showthread.php?t=87648)

r-tea 19 June 2017 21:26

[E] argc, argv example
 
I need an AmigaE example how to get program name while executing from icon. I know there is an easy to use GetProgramName() function of AmigaOS, but it reads only from CLI/Shell.

Asman 19 June 2017 22:20

I've never used E and I don't know how OS stuff is handled there (you know OS calls, OS structures). But when your program started from WB and you sure about that, then you have (after callsys GetMsg) as answer structure WBStartup and there you can find sm_NumArgs and sm_ArgList.

idrougge 19 June 2017 23:20

http://cshandley.co.uk/JasonHulance/beginner_163.html

r-tea 19 June 2017 23:28

Thank You!
I've managed in other way. I found 'workbench/startup' module with wbstartup object defined.
In short:

Code:

...
MODULE 'workbench/startup'
...
DEF startup:PTR TO wbstartup, args:PTR TO wbarg
...
        startup := wbmessage
        args := startup.arglist
        WriteF('\s\n', args[].name)
...

Done in hurry, without any error handling.
:-)
But it works.


All times are GMT +2. The time now is 03:30.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.04009 seconds with 11 queries