unsigned char tmpByte[20];
char * hex2str(char *HEXStr) {
    int i, n;
    for (i = 0; i < strlen(HEXStr)/2; i++) {
        sscanf(HEXStr+2*i, "%2X", &n);
        tmpByte[i] = (char)n;
    }
    tmpByte[strlen(HEXStr)/2]=0;
    return  tmpByte ;
}
char * longasword(long dec) {
    char hexstr[44];
    sprintf(hexstr, "%lx", dec);
    return hex2str(hexstr);
}
long wordaslong(char * the_word){
    int len,i;
    char   hexword[40];
    len = strlen(the_word);
    for (i = 0; i<len; i++) {
        sprintf(hexword+i*2, "%02x", the_word[i]);
    }
    return strtol(hexword ,NULL, 16);
}
 

A Run