sscanf read int from strings of "image_00021"
I have a database of files that I am reading in and working on with the titles created by:
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:
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:
But I get the warning:
sscanf(imgString, "%*c%05d", latestImgNo);
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