Exemplo n.º 1
0
//
// Function: AtoH
//
// Description:
//    AtoH () coverts the IPX address specified in the string
//    (ascii) format to the binary (hexadecimal) format.
//
void AtoH(char *szDest, char *szSource, int iCount)
{
    while (iCount--)
    {
        *szDest++ = (BtoH(*szSource++) << 4) + BtoH(*szSource++);
    }
    return;
}
Exemplo n.º 2
0
void HexBin(char * src, char * dest, int destlen)
////////////////////////////////////////////////////////////////////////////////////
{
// function for conversion hex -> bin strings

    char * srcptr;
    srcptr = src;
    while(destlen--)
    {
        *dest = BtoH(*srcptr++) << 4;     // Put 1st ascii byte in upper nibble.
        *dest++ += BtoH(*srcptr++);      // Add 2nd ascii byte to above.
    }
}
Exemplo n.º 3
0
//
//  PURPOSE:  Converts ascii string to network order hex
//
//  PARAMETERS:
//    src    - pointer to input ascii string
//    dest   - pointer to output hex
//    destlen - size of dest
//
//  COMMENTS:
//
//    2 ascii bytes make a hex byte so must put 1st ascii byte of pair
//    into upper nibble and 2nd ascii byte of pair into lower nibble.
//
void AtoH(
    char            *src,
    unsigned char	*dest,
    int		        destlen)
{
    char *srcptr;
    unsigned char *destTemp;

    srcptr = src;   
    destTemp = (unsigned char *) dest; 

    while(destlen--)
    {
        *destTemp = BtoH(*srcptr++) << 4;    // Put 1st ascii byte in upper nibble.
        *destTemp += BtoH(*srcptr++);      // Add 2nd ascii byte to above.
        destTemp++;
    }
}