Did you try popen() ?

https://stackoverflow.com/questions/43116/how-can-i-run-an-external-program-from-c-and-parse-its-output

Look the example at apps/examples/popen

BR,

Alan

On 10/12/23, MIGUEL ALEXANDRE WISINTAINER <tcpipc...@hotmail.com> wrote:
> Some idea how to capture the data returned by exec ?
>
> Enviado do meu iPhone
>
>> Em 12 de out. de 2023, à(s) 18:16, Alan C. Assis <acas...@gmail.com>
>> escreveu:
>>
>> Hi Greg,
>>
>>> On 10/12/23, Gregory Nutt <spudan...@gmail.com> wrote:
>>>
>>>> On 10/12/2023 2:18 PM, Alan C. Assis wrote:
>>>> The execv on Linux also fails when we can an builtin program, try it:
>>>
>>> You are right, but the semantics are really confusing.  In Bash,
>>> commands that are included inside of Bash are called built-in commands
>>> and you cannot execute them.  We ignore that naming in NuttX because it
>>> onflicts with some historical naming in NuttX:
>>>
>>> Historically, external commands that are NOT part of NSH are called
>>> built-in tasks.  You can execv them if they are in binfs (only).  But
>>> you still can't execv the commands like ls that are a part of NSH.
>>>
>>
>> Thanks for further explanation!
>>
>> Yes, the naming is confusing, but I think it is difficult to find a
>> better name to those commands that are internal of nsh. At this point
>> calling them built-in like in Linux will make things more confuse
>> because the "external" apps are already called built-in.
>>
>> It is something that everyone using NuttX get grasped too fast.
>>
>> BR,
>>
>> Alan
>

Reply via email to