From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,f07a9e32e20151e8 X-Google-Attributes: gidf7344,public X-Google-Thread: fc7fa,f07a9e32e20151e8 X-Google-Attributes: gidfc7fa,public From: hoffman@xdelta.enet.dec.com (Stephen Hoffman) Subject: Re: Command line parameters problem... Date: 1995/10/31 Message-ID: <475hkc$9nd@nntpd.lkg.dec.com>#1/1 X-Deja-AN: 118286187 distribution: world references: organization: Digital Equipment Corp reply-to: hoffman@xdelta.enet.dec.com (Stephen Hoffman) newsgroups: comp.os.vms,comp.sys.vms In article , "Carl J. Lambrecht" writes: : :I am having trouble getting command line parameters passed when running :an executable. The executable is a compiled C source code, which has the :necessary argc,argv code to handle a command line argument, but whenever :I try to run with my command line arguments: : run foo.exe 3500 :I get an error on the 3500 stating that too many parameters have been :used, reenter command with less parameters. Is there a compiler or :linker flag which must be set to allow extra parameters? I am working on :a VAX 4100, running OpenVMS 6.1, and compiled using the standard DEC C :libraries, which appear to have all the C lib functions I need. What am :I missing? You're missing the discussion of foreign commands in the DEC C manual. (Don't you hate it when that happens? :-) Prior to OpenVMS V6.2 and the introduction of the DCL$PATH command path support, one had to set up a foreign command in order to use C's argument-passing (argc and argv) mechanism. ("Passing Arguments to the main Function" is the heading in the _DEC C User's Guide for OpenVMS Systems_ manual.) A foreign command is a DCL (global) symbol that equates to a full device, directory and filename specification preceded by a "$" -- preceded by the "this is a foreign command" indicator character. eg: "fc :== $sys$sysdevice:[000000]imagename.exe" The above C program can now retrieve the arguments via argc and argv. (The OpenVMS V6.2 DCL$PATH support is far more convenient.) ------------------------------ Opinionative ------------------------------- Stephen Hoffman OpenVMS Engineering hoffman@xdelta.enet.dec.com When encryption is outlawed, bayl bhgynjf jvyy unir cevinpl ---------------------------------------------------------------------------