Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bbn!oberon!sm.unisys.com!csun!csuna!abcscnuk From: abcscnuk@csuna.csun.edu (Naoto Kimura) Newsgroups: comp.lang.pascal Subject: Re: Programming ... Pascal Keywords: Pascal, Parameters Message-ID: <1719@csuna.csun.edu> Date: 28 Feb 89 03:41:09 GMT References: <495@chief.UUCP> Reply-To: abcscnuk@csuna.csun.edu (Naoto Kimura (ACM)) Organization: CSU Northridge Lines: 60 In article <495@chief.UUCP> start@chief.UUCP (CompuInvest BBS system ) writes: > >How does one set up a program to read in parameters from the command line? > >Ex. : > >Shell> pascal.prg -param1 -param2 > ^^^^^^ ^^^^^^ > |||||| |||||| >How does one accomplish this in standard (ISO) Pascal, if it is even >possible? Or, if turbo Pascal will accomlish this, how? > >I am using a Pascal compiler for my Amiga (Metacomco's MCC Pascal V2). > >Any help, of course would be appreciated! > > >Thanks, > >Robert Cooper Hmmmm... I seem to remember such a similar query just a month ago... As far as I know, there is no standard way of doing so. There is still some hope, because many implementations of pascal will have ways to access the command line. Here are some implementations that I know of that allow access to the command line parameters: (VM/CMS) PASCAL/VS If I recall, R0 is used to point to the unparsed command line string. You had to write some assembly code to be able to gain access to it. There was also a way to gain access to the parsed arguments (though they were limited to 8 characters). (MS/PC-DOS) Turbo Pascal Use the ParamCount function to find out how many argument strings there were, and the ParamStr(n) function to get the n'th argument string. Version 5.0 allows you to use ParamStr(0) to get the fully qualified filename of the executable. You could probably also look somewhere in the PSP. (NOS) CDC Pascal There is an include file to access parts of the command line. You had to use either a function or procedure to obtain the value of a option. (Unix) Berkeley This compiler allows access to the argument count and argument strings via the 'argc' function and the 'argv' function. //-n-\\ Naoto Kimura _____---=======---_____ (abcscnuk@csuna.csun.edu) ====____\ /.. ..\ /____==== // ---\__O__/--- \\ Enterprise... Surrender or we'll \_\ /_/ send back your *&^$% tribbles !!