I want to use a exe file (convert.exe), inside my C++ program. This “exe” file change my output file format to another format. when, i use this convert.exe from my command-prompt (cmd), i have to type like this;
convert -in myfile -out convertedfile -n -e -h
where;
myfile= name of the file, I obtain from my c++ program
convertedfile= result of the “convert.exe” file
-n, -e, -h = are some parameters (columns) that i need to use to get output file with my
desired data columns.
i tried with system(convert.exe). but, it does not work as i did not know how to use all those parameters.
The
std::systemfunction expects aconst char *, so how about you trysystem("convert -in myfile -out convertedfile -n -e -h")Then, if you want to be a little more flexible, you use
std::sprintfcan create a string with the right elements in it and then pass it to the system() function like so: