C++ Interfacing with command line tools
I am currently trying to understand how to interface with some command line tools in C++. Basically, whenever I am in bash -- I execute some commands to perfrom some action. Let's say that I want to do a par2repair on some file.par2. I would just execute "par2repair file.par2". However, I would like to do the same thing within a C++ application, but have been told that exec() and system() like calls are not good to use (not portable?). Also, how would I parse the data returned by the call to par2repair, for instance, if there was an error? Is there some way to go about doing this? I have not learned this in school, but am trying to develop something on my own which needs this capability. Thank for your input...
Kristian Hermansen
|