PDA

View Full Version : C++ Command line tool - Issue other CLI commands




hiddenpremise
Jan 13, 2009, 02:25 PM
I have created a new project in xCode 2 that is a command line tool. Does anyone know how to issue command line commands from a c++ command line tool?

What I am trying to do is write a c++ command line tool that will issue the "zip -r" command and backup a set of files. My motives are just to learn how to issue command line commands from a c++ program.

Thanks,
Whit



kainjow
Jan 13, 2009, 02:30 PM
I think the easiest would be the system() function.

hiddenpremise
Jan 13, 2009, 02:39 PM
What ".h" file would contain the system() class?

toddburch
Jan 13, 2009, 03:02 PM
Per Xcode -> Help -> Documentation, and typing in "system" in the search field, it tells you <stdlib.h>.

hiddenpremise
Jan 13, 2009, 03:54 PM
<---xcode noob :)

Thanks much for your help. Zip doesn't work through the system command, but I can get other things to work, so I'm happy.

kainjow
Jan 13, 2009, 06:38 PM
It should. Are you setting the working directory?