M
mthies
I have two kinds of file names to read in:
"name_a01_002"
"name_a01_opt02_003"
where the numbers will always have the same amount of digits and will
thus always be integers. I am only interested in the first and the last
number and want to set up scanf to give me these values.
I tried something like
int a,b
if( sscanf(filename, "name_a%2d%_*[^_]_%3d", &a, &b) == 2) success=1;
but it works only for the later one.
Is it at all possible to skip the middle part (_opt02) optionally?
Michael
"name_a01_002"
"name_a01_opt02_003"
where the numbers will always have the same amount of digits and will
thus always be integers. I am only interested in the first and the last
number and want to set up scanf to give me these values.
I tried something like
int a,b
if( sscanf(filename, "name_a%2d%_*[^_]_%3d", &a, &b) == 2) success=1;
but it works only for the later one.
Is it at all possible to skip the middle part (_opt02) optionally?
Michael