Skip to content

Instantly share code, notes, and snippets.

@andrewflash
Created July 3, 2018 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewflash/a2ef7ce62441cc30546451e57e81b739 to your computer and use it in GitHub Desktop.
Save andrewflash/a2ef7ce62441cc30546451e57e81b739 to your computer and use it in GitHub Desktop.
Hex string to Ascii string
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