Path: utzoo!attcan!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.sys.atari.st Subject: Re: argc and argv with gem Keywords: MWC, argc, argv, GEM, commands. Message-ID: <806@philmds.UUCP> Date: 16 Sep 88 05:14:23 GMT References: <358@island.uu.net> <626@mace.cc.purdue.edu> <3441@boulder.Colorado.EDU> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 22 In article <3441@boulder.Colorado.EDU> cochrane@spot.Colorado.EDU (COCHRANE JIM T) writes: >How does one go about writing a GEM program that will accept arguments to >main via argc and argv? I'm using Mark Williams C and when I try to use >argc and argv with a GEM program the program bombs. Although I don't use MWC myself, I will make a few remarks: 1) There is no means that I know of to supply parameters to a Gem program if it is started from the Desktop. 2) If the program is started from a shell, the shell should be a Gem program, otherwise the program cannot use Gem functions. I'm not very sure about this one, though. 3) You don't need to do anything different for a Gem program than for a Tos-Takes-Parameters one. 4) The bus error is perhaps caused by incorrect treatment of the argc,argv list, e.g. accessing an element argv[i], with i >= argc, or argv[0], whose contents is undefined (GEMDOS does not pass the program's name). I even think there are compilers that put a null pointer (not an empty string pointer) in argv[0], which is in effect incorrect - argv[argc] should be the first null pointer of the list. Leo.