Created
July 3, 2018 05:00
-
-
Save andrewflash/a2ef7ce62441cc30546451e57e81b739 to your computer and use it in GitHub Desktop.
Hex string to Ascii string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void hexToAscii(char *inBuff, char *outBuff) | |
{ | |
while(*inBuff) | |
{ | |
unsigned int ch; | |
int n; | |
if ( sscanf(inBuff, "%2x%n", &ch, &n) != 1 ) | |
{ | |
break; | |
} | |
inBuff += n; | |
*outBuff = ch; | |
outBuff++; | |
} | |
*outBuff = '\0'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment