I want to extract the integer value form my file name, and there's no space between my file name like Quote: part1.dat or part12.dat Code: char src[20] = "part12.dat"; char dest[10]; int *i; sscanf(src, "%[1-9]", &i); printf("%d", *i); could u plz correct my formatted text
Please refer to the following code...u will be able to undertand the mistake urself...always try to check the syntax of a function before using it.... Code: const char * str = "part346.dat"; int value; sscanf(str,"%*[^0-9]%d",&value); printf("%d",value);