home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog_c / mklib.lzh / MKLIB / EDLIB / HEXTOINT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-16  |  374 b   |  19 lines

  1. /* edlib  version 1.0 of 04/08/88 */
  2. /* this function takes a string of hex digits and returns its value */
  3. #include <ctype.h>
  4.  
  5. int hextoint(number)
  6. char *number;
  7. {
  8.     int value = 0;
  9.  
  10.     while ( *number )
  11.         if ( isxdigit(*number) ) {
  12.             value = ( value << 4 )  + toint(*number++);
  13.         } else {
  14.             return(value);
  15.         }
  16.  
  17.     return(value);
  18. }
  19.