Quote Originally Posted by zach
An example of a value read from the file is 15.75 as char and that format I wish to maintain; i.e., two decimal number so I can do further arithmetic with that number.
Two approaches:
  • Remove the '.' from the string then convert it to an integer. Now you deal with integers that are 100 times the actual value, so when you want to print, you just do n / 100 to get the part before the decimal point and n % 100 to get the part after the decimal point. Of course, you have to keep in mind the max value for the integer type.
  • Use a fixed point arithmetic library or write your own.