Recent

Author Topic: Console application command line parameters  (Read 195 times)

JimKueneman

  • Full Member
  • ***
  • Posts: 157
Console application command line parameters
« 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

winni

  • Hero Member
  • *****
  • Posts: 609
Re: Console application command line parameters
« Reply #1 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

JimKueneman

  • Full Member
  • ***
  • Posts: 157
Re: Console application command line parameters
« Reply #2 on: November 22, 2019, 02:31:28 am »
That doesn't work either.  Figured it out from the Linux side...

.\myapp -V -s

winni

  • Hero Member
  • *****
  • Posts: 609
Re: Console application command line parameters
« Reply #3 on: November 22, 2019, 02:42:09 am »
What parameters?

-V -s

or

-t -V

You show both.

winni

  • Hero Member
  • *****
  • Posts: 609
Re: Console application command line parameters
« Reply #4 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

JimKueneman

  • Full Member
  • ***
  • Posts: 157
Re: Console application command line parameters
« Reply #5 on: November 22, 2019, 03:20:02 am »
Sorry what was missing was

.\

in front of the application name