Re: Beginner question

Posted by Joey p12386 on May 15, 2005

In Reply to: Beginner question posted by Miron on May 14, 2005

You can do this with the functions ParamCount and ParamStr.

ParamCount - tells you the amount of paramaters passed to the program so in your case it would return 1.

ParamStr(ParmIndex: Integer) - returns the parameter whose index is passed. So if you did ParamStr(1) it would return 'txtfile.txt'.

Note ParamStr will trim off " symbols if surrounded by, if it isnt the next white space will be the break.

So you could use this:

if ParamCount = 1 then
  WriteLn(ParamStr(1))
else
  Halt;

Then you could see what's passed :)

Hope it helps,

Joey ^___^

Related Articles and Replies



Reply

Name:
Password:

Subject:

Comments: