Hi guys I am trying to decode an isbn. My function looks like this:int decode

(FILE* fp, const char str[], char area[], char publisher[], char title[]); This function gets a file pointer that contains a prefix table, a 10 digit isbn in str and area[], publisher[] and title[] are empty but if this function is successful it will break the isbn up into pieces were those 3 string will be filled and return 1, if not 0.

So basically how I was attempting this problem was by using sscanf to convert the string to a double, then to an into to break the numbers up. So I am able to isolate the numbers individually but I want to be able to break them up in smaller digits.

For example ISBN= 9070002043

I want to be able to check is the area is 9, 90, 907,9070 or 90700. If none of those are valid then I know its an invalid ISBN. If one of those work for example the 90. Know I want to get if 7,70,700 is in the range of the publisher etc..

I am not sure If I approached this program the totally wrong way so if any sees an easier way and could point me in the right direction it would really be great.

For reference some of the file looks like this. The first digit is the area code, the second and third is the range that the publisher is between.

88 00 19

88 200 599

88 6000 8499

88 85000 89999

88 900000 999999

Code:firstdigit=tempstring; ifirstdigit=(int)firstdigit%10; seconddigit=(value/10); //digit 9 iseconddigit=(int)seconddigit%10; thirddigit=(value/100); //digit 8 ithirddigit=(int)thirddigit%10; fourthdigit=(value/1000); // digit 7 ifourthdigit=(int)fourthdigit%10; fifthdigit=(value/10000); // digit 6 ififthdigit=(int)fifthdigit%10; sixthdigit=(value/100000); // digit 5 isixthdigit=(int)sixthdigit%10; seventhdigit=(value/1000000); // digit 4 iseventhdigit=(int)seventhdigit%10; eighthdigit=(value/10000000); // digit 3 ieighthdigit=(int)eighthdigit%10; ninethdigit=(value/100000000); // digit 2 ininethdigit=(int)ninethdigit%10; tenthdigit=(value/1000000000); //digit 1 itenthdigit=(int)tenthdigit%10;