This looks like Turbo Pascal.
In which case the code you want is the ParamCount and ParamStr functions.
if Paramcount < 1 then
writeln('No parameters on command line')
else
writeln(Paramcount, ' paramete(s)');
for i := 1 to Paramcount do
writeln(ParamStr(i));
Paramstr(index) is an array of the command line parameters. Blanks and tabs separate the parameters on the command line.
Main Topics
Browse All Topics





by: BillBachPosted on 2009-04-07 at 08:55:28ID: 24088694
In the C language, the main() function accepts two arguments, known commonly as argc and argv, which contains the count and the values or each command-line argument. I would expect that your PASCAL compiler will have a similar feature. A quick search seems to point to using an array called ParamStr[n] when n=0 is the program name, n=1 is the first parameter, and so on. However, checking your specific compiler manual is the best way to figure this out. Here's some links to get you started, though: a_ism/ISM2 110/pas074 .htm rg/sites/w ww.gnu-pas cal.de/gpc / Accessing -Command-L ine-Argume nts.html
http://www.hkbu.edu.hk/~bb
http://www.mirrorservice.o