home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!decwrl!deccrl!news.crl.dec.com!rdg.dec.com!ryn.mro4.dec.com!mrdood.enet.dec.com!mdoody
- From: mdoody@bump.enet.dec.com (Michael Doody)
- Subject: Re: How can I retrieve the command string from within Pascal program ?
- Message-ID: <1992Aug25.180355.22056@ryn.mro4.dec.com>
- Lines: 31
- Sender: mdoody@mrdood.enet.dec.com (Michael Doody)
- Reply-To: mdoody@bump.enet.dec.com
- Organization: Digital Equipment Corporation
- References: <13453.2a9509ab@ohstpy.mps.ohio-state.edu>
- Date: Tue, 25 Aug 1992 18:03:55 GMT
-
-
-
- > How could one retrieve the on-line program parameters,
- >such as the program name, or the whole command string
- >from within the pascal program ?
-
- Since you are using VAX Pascal, you have two choices:
-
- 1) Define your program using $ SET COMMAND and then use the
- $CLI routines to parse the command line arguments.
-
- 2) Define your program as a foreign command using $ prog :== $prog.exe
- and use the Run Time Library routine LIB$GET_FOREIGN.
-
- #1 is the standard VMS method, #2 is quicker.
-
- [inherit('sys$library:lib_routines')]
- program temp( input, output )
-
- VAR
- command_line : VARYING [132] OF CHAR;
- sys_stat : INTEGER;
-
- BEGIN
- sys_stat := LIB$GET_FOREIGN( command_line.body,,command_line.length );
- if not odd( sys_sat ) then lib$stop( sys_stat );
-
- WRITELN( 'Command line is ', command_line );
- END;
-
- Mike
-