Is there a way to retrieve the number of parameters using GPC?
See ya! Orlando Llanes
"Meine Damen und Herren, Elvis hat soeben das Gebaeude verlassen!"
"Look out fo' flyeeng feet" O__/ a010111t@bc.seflin.org /|____. O <__. /> / \ ____________|_________ http://ourworld.compuserve.com/homepages/Monkey414
According to Orlando Llanes:
Is there a way to retrieve the number of parameters using GPC?
ParamCount. It works just like in BP.
BTW, you "misused" the "GPC REFERENCE" subject line which was intended to mark sections of the GPC reference manual posted to this list. Now you are condemned to write a section about `ParamCount'. ;-b
He, he, he ... :-)
Peter
On Mon, 1 Jun 1998, Peter Gerwinski wrote:
you are condemned to write a section about `ParamCount'. ;-b
:)
@unnumberedsomething Description
@samp{ParamCount} returns the number of command-line arguments seperated by spaces present after the program is executed. @samp{ParamCount} returns 0 <1?> if the only statement on the command-line is the name of the program.
See ya! Orlando Llanes
"Meine Damen und Herren, Elvis hat soeben das Gebaeude verlassen!"
"Look out fo' flyeeng feet" O__/ a010111t@bc.seflin.org /|____. O <__. /> / \ ____________|_________ http://ourworld.compuserve.com/homepages/Monkey414
According to Orlando Llanes:
@samp{ParamCount} returns the number of command-line arguments
seperated by spaces
^^^^^^^^^^^^^^^^^^^ Misleading. A UNIX shell can even pass parameters *containing* spaces when they are surrounded by quotation marks or such.
present after the program is executed.
Also misleading: This sounds for me as if the parameters aren't present until the program has finished.
@samp{ParamCount} returns 0 <1?>
0.
if the only statement on the command-line is the name of the program.
This implies that you are invoking the program from a command line. It can also be invoked from another program, in particular a GUI.
I suggest the following:
@c ----------------------------------------------------------------------------
@node ParamCount @unnumberedsec ParamCount @cindex ParamCount
@unnumberedsubsec Syntax
@smallexample Function ParamCount: Integer; @end smallexample
@unnumberedsubsec Description
@samp{ParamCount} returns the number of command-line arguments given to the program. @samp{ParamCount} returns 0 if no arguments have been given to the program; the name of the program as an implicit argument is not counted.
@unnumberedsubsec Standards
@samp{ParamCount} is a Borland Pascal extension.
@unnumberedsubsec Example
@example Program Test;
Var i: Integer;
begin writeln ( 'You have invoked this program with ', ParamCount, ' arguments.' ); writeln ( 'These are:' ); for i:= 1 to ParamCount do writeln ( ParamStr ( i ) ); end. @end example
@unnumberedsubsec See also
@ref{ParamStr}.
@c ----------------------------------------------------------------------------
Greetings,
Peter
On Mon, 1 Jun 1998, Peter Gerwinski wrote:
BTW, you "misused" the "GPC REFERENCE" subject line which was intended to mark sections of the GPC reference manual posted to this list. Now
I don't know what I was thinking, but I didn't intentionally mis-use the GR subject line. But I did want to add a description to the reference regarding ParamCount.
Now for the reason I asked if GPC had anything to count the number of parameters. I assume I didn't misspell ParamCount because nobody has corrected me, and I also assume that capitalization doesn't matter because it's Pascal, so here goes... I got an error from GPC saying that ParamCount is an undeclared identifier. The following is the program I wrote that gave me the error:
PROGRAM Tmp;
BEGIN WriteLn( ParamCount ); END.
See ya! Orlando Llanes
"Meine Damen und Herren, Elvis hat soeben das Gebaeude verlassen!"
"Look out fo' flyeeng feet" O__/ a010111t@bc.seflin.org /|____. O <__. /> / \ ____________|_________ http://ourworld.compuserve.com/homepages/Monkey414
According to Orlando Llanes:
Now for the reason I asked if GPC had anything to count the number of
parameters. I assume I didn't misspell ParamCount because nobody has corrected me, and I also assume that capitalization doesn't matter because it's Pascal, so here goes... I got an error from GPC saying that ParamCount is an undeclared identifier. [...]
Which version of GPC are you referring to? It has become a built-in function of GPC on 10 Nov 1997 and is not present in gpc-971001.
Peter
Date: Mon, 1 Jun 1998 10:28:25 -0400 (EDT) From: Orlando Llanes a010111t@bc.seflin.org Subject: GPC REFERENCE: ParamCount... To: GNU Pascal gpc@hut.fi
Is there a way to retrieve the number of parameters using GPC?
Try "ParamCount " ;-)
Best regards, The Chief -------- Dr. Abimbola A. Olowofoyeku (The African Chief) Email: laa12@keele.ac.uk Homepage: http://ourworld.compuserve.com/homepages/African_Chief/ Author of: Chief's Installer Pro 4.25 for Win16 and Win32: ftp://ftp.simtel.net/pub/simtelnet/win3/install/chief425.zip