Recent

Author Topic: Applications with parameters?  (Read 2430 times)

Elmug

  • Hero Member
  • *****
  • Posts: 849
Applications with parameters?
« on: August 25, 2011, 09:46:02 am »
Good forum people,

I have some plans for applications, typically short ones, or even non-graphical ones, that can be run from a mother application, sending to two or three parameters, and the caller application receives parameters back.

I hope there is already provisions for that in Lazarus/FreePascal and I would appreciate some basic guidance for further search/study and put to some use.

Thanks!

Arbee

  • Full Member
  • ***
  • Posts: 223
Re: Applications with parameters?
« Reply #1 on: August 25, 2011, 10:26:21 am »
You refer to program parameters?

That can be done via the functions ParamCount and Paramstr.

See this example from the Free Pascal documentation:

Code: [Select]
Program Example46;

{ Program to demonstrate the ParamCount and ParamStr functions. }
Var
  I : Longint;

begin
  Writeln (paramstr(0),' : Got ',ParamCount,' command-line parameters: ');
  For i:=1 to ParamCount do
    Writeln (ParamStr (i));
end.

And to get information back into the calling program, see : http://wiki.lazarus.freepascal.org/Executing_External_Programs
« Last Edit: August 25, 2011, 03:18:47 pm by Arbee »
1.0/2.6.0  XP SP3 & OS X 10.6.8

 

TinyPortal © 2005-2018