Hi all,
I have a database of files that I am reading in and working on with the titles created by:
Code:
...
ugv++;
sprintf(input_file, "UGV_%i/image_%05d.jpg", ugv, img_num)
...
This creates a list of files like this, which I need to be ordered so I can sort the files easily in the folder:
image_00001.jpg
image_00002.jpg
...
image_00009.jpg
image_00010.jpg
image_00011.jpg
I can read in the titles of these files easily enough, but because the integers I want (1,2,...9,10,11) are preceded by an unknown number of zeroes, reading in the desired number is much more difficult than if you have a known position of an integer.
My code currently is:
Code:
int latestImgNo;
sscanf(imgString, "%*c%05d", latestImgNo);
But I get the warning:
warning: format '%05d' expects type 'int*', but argument 3 has type 'int'
I have tried making latestImgNo a pointer, but it gives the same sorts of errors.
I have tried looking up delimeters, but that doesn't really help (as far as I know) because I don't know how many zeroes to search past.
Should I use something to convert "00021" as a string to an integer, that would just ignore zeroes?
Thanks for any suggestions