Do you have a question? Post it now! No Registration Necessary
Subject
- Posted on

Re: How to excute shell command and return result string ?

system(3) is the high level version that runs the command
via a shell for full shell redirection, etc.
That sets up the pipes (file redirection) that the exec(2) family won't:
you'd have to dup() stdout before exec() to get the output.

Agreed, use the direct functions when possible
(no need for fork/exec other processes just to get the parameters,
works faster too), but is more work for the programmer.
Site Timeline
- » Linux Input Driver question
- — Next thread in » Embedded Linux
-
- » UK Embedded Masterclass - 7th and 12th May - Cambridge and Bristol
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Televisie wisselt van analoog naar digitaal kanaal en terug?
- — The site's Newest Thread. Posted in » Electronics (Dutch)
-