[fpc-pascal]Problem of ParamStr

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Feb 19 10:59:55 CET 2003

On Wed, 19 Feb 2003, milimeter wrote:

> Hello, everybody
>   I wrote the following code in program foo.pp:
> >>>>>>>>>
>   writeln(ParamStr(1));
> <<<<<<<<<
>   And when I run it with a parameter "foo *.txt", I mean to get "*.txt", but
> unfortunately, it prints out "test.txt", where test.txt is a file under the
> same directory. I know the shell extends my command to "foo test.txt". How
> can I get the original parameter without the extension of shell?

You cannot. If you want that, you must type
  foo "*.txt"
on the shell command line.
There is nothing FPC can do about this, the shell has expanded all arguments
already before the FPC program is invoked.


More information about the fpc-pascal mailing list