atoh

 
Syntax

         

#include "coridium.h"
int atoh( char *str );
 

The atoi() function converts str into an integer, and returns that integer. str should start with whitespace or some sort of number, and atoi() will stop reading from str as soon as a non-numerical character has been read. For example:

  int i;
  i
= atoh( "200" );
  i
= atoh( "0x200" );
  i
= atoh( "   200." );
  i
= atoh( "   200+22" );
  i
= atoh( "   200 bottles of beer on the wall" );
 

All five of the above assignments to the variable i would result

in it being set to 512.

 

If the conversion cannot be performed, then atoh() will return zero:

 

  int i = atoh( " does not work: " );  // results in i == 0
 

You can use sprintf() to convert a number into a string.