[fpc-pascal]Re: About GetOpts and configuration file parsing

Yet Another Geek yetanothergeek at yahoo.com
Sat Jul 13 08:29:37 CEST 2002

> well, I am not planning to allow -- at all, I don't
like it, 
> so I suppose I can skip that row.

You can skip all of the argc and argv  stuff, then -
All you need is this one line:
>>  OptSpecifier:=['/'];
This tells getopts to use '/' for all single-char

> do you mean that any FPC program has defined argc 
 - YES.

> (I suppose ParamCount returns this value, then)

"ParamCount" does not include the program name in its
but "argc" does. Thus "ParamCount" is always one less
than "argc"
Both of the indexes are zero-based .
( The program name is index zero )

Also note that Paramstr(0) returns the fully-qualified
path to 
the executable, where argv[0] returns the actual
command entered 
on the command line (it may or may not include the

So if you just typed "myprog" at the command prompt,
  argv[0] would be "myprog", 
  ParamStr(0) would be "C:\path\to\myprog.exe"

> and argv as an array of PChars that can be modified?
 - YES.
 All of this is at least true for Linux, 
 I have not tested it with Windows or DOS.
 - I will leave that up to you ;-)

Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes

More information about the fpc-pascal mailing list