tags:

views:

42

answers:

1

I'm working on a Command Line app to help me on launchd tasks to know if a task is running by returning a BOOL, the problem comes when i need to do a command line and obtain the output for further parsing.

i'm coding it in C/C++ so i can't use NSTask for it, any ideas on how to achieve the goal?

The Command

sudo launchctl list -x [job_label]

If i use system(), i'm unable to get the output so in further research I came with popen(), but no success there.

Thanks in advance.

A: 

You'll want to create a pipe from which you can read the output of the program. This will involve using pipe, fork, exec*, and maybe even dup. There's a good tutorial on the linux documentation project.

Kaleb Pederson