| zyhsu1 (4) | |
|
Dear sir: I have a sequence image files: from box0001.jpg to box0015.jpg, I want to cut box0001.jpg - box0009.jpg to a folder(C:/box1/), and cut box0011.jpg - box0015.jpg to another folder (C:/box2/), how do I use array and a loop to do this? Can someone help? Thanks a lot! Sincerely yours Ze Yi Hsu | |
|
|
|
| Catfish3 (279) | |
|
For such purposes a script would be better than a program. http://en.wikipedia.org/wiki/Batch_file http://en.wikipedia.org/wiki/Shell_script Anyway, in a for() loop you would use: http://cplusplus.com/reference/cstdio/rename/ http://cplusplus.com/reference/cstdio/sprintf/ You need sprintf() to build the filename string from the current index in the for() loop. | |
|
|
|
| zyhsu1 (4) | |
|
Dear Catfish3: Thanks a lot! Best Ze Yi Hsu | |
|
|
|
| zyhsu1 (4) | |
|
Dear catfish3: Sorry to bother you again, If using program, how do I choose box0001.jpg to box0015.jpg by using arrar, I dont want to write like this; box[ ]={box0001.jpg, box0002.jpg,box0003.jpg....} because the image files might be a lot?? I want to give a range, such as 1-15, or 16-200...etc how do I make array by using the range? Best Ze-Yi Hsu | |
|
|
|
| Catfish3 (279) | ||||
|
Use the sprintf() function to create the arrays (not arrar, but array). This is the traditional way (like how it can be done in C language, not just C++).
The new way is by using string streams. http://cplusplus.com/reference/sstream/ But I have to see your current source code (written program) to understand which way is better for you. | ||||
|
|
||||
| zyhsu1 (4) | |
|
Dear catfish3: Thanks! This is a big help! Best ze-Yi Hsu | |
|
|
|