Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-02

Problem of ParamStr

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

milimeter

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?

Thanks,
mili

Reply by email

Michael Van Canneyt
to milimeter
milimeter wrote 10 lines
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.

Michael.

Reply by email