[fpc-pascal] How to send operating system commands (Linux on RPi)?

Sven Barth pascaldragon at googlemail.com
Sat Jul 2 09:21:17 CEST 2016


Am 02.07.2016 07:55 schrieb "Bo Berglund" <bo.berglund at gmail.com>:
>
> On Sat, 02 Jul 2016 01:12:34 +0200, Bo Berglund
> <bo.berglund at gmail.com> wrote:
>
> >The commands I am looking at now are:
> >sudo ifup wlan0
> >sudo ifdown wlan0
> >
> >How could this be accomplished in a FreePascal program running as user
> >Pi?
>
> To be specific I would like to know how I can send any command to the
> Linux operating system from my FreePascal program?
>
> Just doing this seems not to cut it:
>
> writeln('sudo ifup wlan0');
>
> This just *displays* the text on the program console, but I want it to
> go to the operating system as a command...
>
> On Windows one has to start cmd with the wanted command as a
> parameter, what is the corresponding method on Linux from within
> FreePascal?

Either fpsystem() from unit BaseUnix (this is the FPC variant of the C
system() call) or TProcess if you should need to provide password input on
a GUI.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160702/258ed3e4/attachment.html>


More information about the fpc-pascal mailing list