CompuServe Messages

#main(argc,argv)

    19-Jun-93 02:42:13
Sb: #main(argc,argv)
Fm: Bart Mathias 72017,1005
To: all
Two Major Questions (involving a bunch of minor puzzles). Finishing up a little program, almost ready to release it to the world. Just two relatively simple things to add: WorkBench startup capability and an ASL file requester for those running from OS 2.0+. Both simple things are proving formidable. For the WorkBench part, I linked with Astart.obj, which I got from the kind folks at Commodore. But the documentation says that, if the program was started from CLI, the number of command line arguments will be in argc and the arguments themselves in argv, passed as "main (argc,argv)," with "int argc;" and "char **argv;." But no mention of what all that means, such as where does one find this "argc" and "argv." Wherever they may be, I found an address register that points approximately to copies of the second (and later) CLI arguments, so I can run from the CLI. As for running the program from the WorkBench, I can do that too, in a way. Except that when I do an extended select I need a file name so I can Open() and Read() the file clicked on, but all the address in the sm_ArgList offset in the WBStartup structure points to is a bunch of strange numbers, e.g. (after shift-double-clicking on the tool icon and one project icon so there were two arguments) 000A17D5 002023FC 000A1803 … (middle one must be an address). So Major Question number 1 is, How do I convert sm_ArgList into something useful? I didn't have to read the fine manual much to get a general idea of how to put in an ASL file requester. But instead of popping up on my custom screen, it came out on the WorkBench screen. Read the fine manual some more. OK, I need a TagList to tell it what window. Spend a couple more hours to come up with a fairly clear–but apparently wrong–idea of how to manage a TagList, and the requester still comes out behind my screen on the WorkBench. Major Question number 2: What am I doing wrong? Here are the snippets of my code that seem relevant (most BEQs, BNEs, and LEAs deleted for brevity): [ MORE ]