RouteX Document Router Toolkit
Main Functions Types & Errors Query Language Demo Home

rxCharToHex

Converts an ASCII character to it's hex form. Use this if you are writing your own query conversion function. In general though it is easier to simply call rxConvertQuery. Note that this function does not put the leading "0x" in the string. You have to do that yourself.

If you are writing your own hexadecimal query, make sure that you do not convert the query operators to hex.

The output hex form is not null terminated but is a two character string. If you wish it null terminated allocate a three character string and make the third character a null (0). rxCharToHex will not overwrite this character. (If you use strcpy to copy it you must have it null terminated)

Synopsis

void rxCharToHex( UCharT C, UCharT *Output )

Arguments

C The character to convert
Output A string containing the hex form of the character.

Returns

Nothing.

Related Functions

rxCharToHex, rxHexToChar, rxAddQuery

Example


void MakeHexWord( char *hex, char *word) {



   char  *hloc = hex;

   char  *wloc = word;

   char  temphex[2];  



   strcpy( hex, "0x");   // add the hex prefix

   hloc += 2;



   while( *wloc != 0 ) {



      rxCharToHex( *wloc, temphex );

      memcpy( hloc, temphex, 2);



      hloc += 2;

      wloc++;

   }

 

   *hloc = 0;  // null terminate our hex word

}

 

Previous Main Next Home

Copyright 2000 Lextek International