Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-07

Re: It is possible to pass command line to pascal

5 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Guillermo Martínez
Show quoted text 16 lines
From: Rainer Stratmann Subject: Re: [fpc-pascal] It is possible to pass command line to pascal On Sunday 30 June 2013 00:59:59 you wrote: > I Tried, but only return an integer not a string value. Thats right. You have to put the result in a file and then afterwards read the file. ls uname -r > file.txt The integer is the result code of the execution. It contains information if the execution was successful.

You may also use a TProcess object:
http://www.freepascal.org/docs-html/fcl/process/tprocess.html

Here you have a tutorial with some examples:
http://wiki.lazarus.freepascal.org/Executing_External_Programs#TProcess

Reply by email

Johan Tu Toit
to Guillermo Martínez

Hi all, thanks for your help, I am happy to know about fpuname function from the baseunix unit. the fpSystem function from unix unit also helpfull but only return an integer. I am still looking on how to get a result as a string not a integer only

Guillermo Martínez wrote 26 lines
> From: Rainer Stratmann > Subject: Re: [fpc-pascal] It is possible to pass command line to > pascal > On Sunday 30 June 2013 00:59:59 you wrote: > > I Tried, but only return an integer not a string value. > > Thats right. > > You have to put the result in a file and then afterwards read the > file. > > ls uname -r > file.txt > > The integer is the result code of the execution. > It contains information if the execution was successful. > You may also use a TProcess object: http://www.freepascal.org/docs-html/fcl/process/tprocess.html Here you have a tutorial with some examples: http://wiki.lazarus.freepascal.org/Executing_External_Programs#TProcess _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Sven Barth
to Johan Tu Toit
Johan Tu Toit wrote
Hi all, thanks for your help, I am happy to know about fpuname function from the baseunix unit. the fpSystem function from unix unit also helpfull but only return an integer. I am still looking on how to get a result as a string not a integer only

You already quoted where you find a solution for this below:

Show quoted text 5 lines

It's not a simple "result value", but you'll need to do a bit of work.

Regards,
Sven

Show quoted text 28 lines
On 7/1/13, Guillermo Martínez wrote: >> From: Rainer Stratmann >> Subject: Re: [fpc-pascal] It is possible to pass command line to >> pascal >> On Sunday 30 June 2013 00:59:59 you wrote: >>> I Tried, but only return an integer not a string value. >> Thats right. >> >> You have to put the result in a file and then afterwards read the >> file. >> >> ls uname -r > file.txt >> >> The integer is the result code of the execution. >> It contains information if the execution was successful. >> > You may also use a TProcess object: > http://www.freepascal.org/docs-html/fcl/process/tprocess.html > > Here you have a tutorial with some examples: > http://wiki.lazarus.freepascal.org/Executing_External_Programs#TProcess > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Mark Morgan Lloyd
to Johan Tu Toit: Hi all, thanks for your help, I am happy to know about fpuname function from the baseunix…

Johan, READ THE ENTIRE MESSAGE THAT YOU ARE QUOTING. You might be used to top-posting, but the convention on this ML is bottom-quoting and those links aren't just bits of somebody's sig, they contain the answer to your question.

Johan Tu Toit wrote 10 lines
Hi all, thanks for your help, I am happy to know about fpuname function from the baseunix unit. the fpSystem function from unix unit also helpfull but only return an integer. I am still looking on how to get a result as a string not a integer only > You may also use a TProcess object: > http://www.freepascal.org/docs-html/fcl/process/tprocess.html > > Here you have a tutorial with some examples: > http://wiki.lazarus.freepascal.org/Executing_External_Programs#TProcess

Apologies to everybody else for top-quoting and "shouting", but I think there's a possibility that the OP's missed the message due to unfamiliarity with the medium.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Marco van de Voort
to Johan Tu Toit: Hi all, thanks for your help, I am happy to know about fpuname function from the baseunix…

In our previous episode, Johan Tu Toit said:

Hi all, thanks for your help, I am happy to know about fpuname function from the baseunix unit. the fpSystem function from unix unit also helpfull but only return an integer. I am still looking on how to get a result as a string not a integer only

First, please post the actual command line to execute and if where (what directory) matters. E.g. it matters for ls, but not for uname.

Since

>> ls uname -r > file.txt

this is a bit too vague and ambiguous.

Reply by email