Lazarus

Programming => Operating Systems => macOS / Mac OS X => Topic started by: JimKueneman on November 22, 2019, 01:37:53 am

Title: Console application command line parameters
Post by: JimKueneman on November 22, 2019, 01:37:53 am
What is the right way to start a console application and pass parameters.  If I run the application in the debugger the parameters are passed and all works as expected.  If I try to run it through the terminal window with:

open myapp --args -t -V

it opens but the parameters are not passed in.

Thanks,
Jim
Title: Re: Console application command line parameters
Post by: winni on November 22, 2019, 02:26:51 am
Hi!

Open does not accept your parameters but only its own

Just do

Code: Bash  [Select][+][-]
  1. myapp -t -V &

The  & puts the app in the background and the terminal is free for other stuff.

Winni
Title: Re: Console application command line parameters
Post by: JimKueneman on November 22, 2019, 02:31:28 am
That doesn't work either.  Figured it out from the Linux side...

.\myapp -V -s
Title: Re: Console application command line parameters
Post by: winni on November 22, 2019, 02:42:09 am
What parameters?

-V -s

or

-t -V

You show both.
Title: Re: Console application command line parameters
Post by: winni on November 22, 2019, 02:47:50 am
Give youself some echo


Code: Pascal  [Select][+][-]
  1. begin  // program
  2.  
  3. write (paramstr(0) + lineEnding + paramstr(1) + lineEnding +paramstr(2) );
  4.  
  5. ......
  6. end.
  7.  

Winni
Title: Re: Console application command line parameters
Post by: JimKueneman on November 22, 2019, 03:20:02 am
Sorry what was missing was

.\

in front of the application name
TinyPortal © 2005-2018