Execute a program with arguments in C++
Posted on 2003-03-07
I am new to programming in C++ and need a bit of help. I am trying to write a program so that I can automate a program to convert files from .bmp to .jpeg. They are screenshots from a game and there are about 10,000 so I need to convert them to jpeg, but in an automated fashion (I dont have 100 hours to site there and change the name of the file to convert).
So here is what I have
1) SFN00001.bmp - SFN1476.bmp
2) program called imgcon which needs the following syntax "imgcon -jpg SFN0001.bmp" to convert
Now I know how to automate it with a loop BUT i cant figure out how to execute it and have the name be a variable. I am willing to change the names to numbers but if there is a way i dont have to that would be great.
I tryed doing a string name, cin >> name (SFN) and doing a int for rhe numbers. I have seen people using system and exec but Im not sure which one to use, and which I can add variables for the path to. Thank you to anyone who helps me, and im sorry I can only offer 75 points.