Article View: vmsnet.misc
Article #306Re: How to run a C program taking command line arguments on VMS
From: Carl J Lydick
Date: Wed, 28 Feb 1996 23:27
Date: Wed, 28 Feb 1996 23:27
61 lines
2720 bytes
2720 bytes
In article <4h1u5d$s5c@news.fsu.edu>, meil@firnvx.firn.edu (Lynn Mei) writes:
=Could someone tell me how to run a C program which takes command line
=arguments on VAX/VMS? I have checked the FAQ about openVMS and tried the
=instructions. But I couldn't get it work. I don't have an openVMS mannual.
=Please help me!
=
=My program is like:
=
=/* myprog.c */
=
= main(argn, **argv)
= {
=
= ...
=
= }
=
=If run on Unix or DOS, I could type something like
=
= myprog -lu abcd
=
=How to run it on VMS?
=
=I'd appreciate your help!
From the FAQ which you claim to have read:
------------------------------------------------------------
DCL1. How do I run a program with arguments?
The RUN command does not accept arguments. To pass arguments to a program,
you must use what is called a "foreign command". For example:
$ uudecode :== $disk:[dir]uudecode.exe
$ uudecode filespec
The leading $ in the symbol definition is what makes it a foreign command.
If the device and directory is omitted, SYS$SYSTEM: is assumed. For more
information on foreign commands, see the OpenVMS User's Manual.
See also question PROG2.
If you want to create a detached process that takes arguments from a command
line, it must be run under the control of a command line interpreter
(typically DCL). This is done by placing the command line in a file,
specifying SYS$SYSTEM:LOGINOUT.EXE as the image to run and the command file
as the input. For example:
$ OPEN/WRITE CMD TEMP_INPUT.COM
$ WRITE CMD "$ MYCOMMAND arguments"
$ CLOSE CMD
$ RUN/DETACHED SYS$SYSTEM:LOGINOUT /INPUT=TEMP_INPUT.COM
------------------------------------------------------------
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL
Disclaimer: Hey, I understand VAXen and VMS. That's what I get paid for. My
understanding of astronomy is purely at the amateur level (or below). So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it. If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.
Technical Details
Message-ID:
<4h2oda$n7q@gap.cco.caltech.edu>Path:
arc1-ca.pugleaf.net!SOL1.GPS.CALTECH.EDU!CARLReferences:
<4h1u5d$s5c@news.fsu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!SOL1.GPS.CALTECH.EDU!CARL From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) Newsgroups: vmsnet.misc,comp.lang.c Subject: Re: How to run a C program taking command line arguments on VMS Date: 28 Feb 1996 23:27:38 GMT Organization: HST Wide Field/Planetary Camera Distribution: world Message-ID: <4h2oda$n7q@gap.cco.caltech.edu> References: <4h1u5d$s5c@news.fsu.edu> Reply-To: carl@SOL1.GPS.CALTECH.EDU NNTP-Posting-Host: sol1.gps.caltech.edu