Still having problems. I get this compiling error:
14: error: incompatible types in assignment
18: error: incompatible types in assignment
And I still can't figure out the correct syntax for passing variables into the rename function.
Code:
#include <stdio.h>
#define PREFIX "_MG_"
#define EXT ".JPG"
int main()
{
int start_suffix = 7398, end_suffix = 8199, suffix = 9010;
char old_name[15], new_name[15];
while (start_suffix <= end_suffix ) {
// Old file name - Count up
old_name = sprintf("%s%04d%s",PREFIX, start_suffix, EXT);
start_suffix++;
// New file name - Count down
new_name = sprintf("%s%04d%s\n",PREFIX, suffix, EXT);
suffix--;
rename("old_name", "new_name");
}
return 0;
}
Adak ..... I don't see the rename function in your code. Is there another C function that renames files? Perhaps ultoa or strcat?