PDA

View Full Version : [C++] Run an external program and read its output



343GuiltySpark
November 1st, 2010, 05:17 PM
Hi,

I'm designing a little server to use at home, but I need to have it run cd and ls at some points.

Problem is, I don't know how I can do it.
How can I run a program (e.g, ls) and then read its output? (technically I don't really need to read it, it's enough I send it to the client).

Thanks!

worksofcraft
November 2nd, 2010, 08:45 AM
idk why nobody answered yet

int system (http://www.cplusplus.com/reference/clibrary/cstdlib/system/) ( const char * command );

p.s. oh yes... I do know why nobody answered yet... you get better response in "programming talk" forum for this ;)