// Shortest function to convert an ascii hex digit to binary
// (assumes a valid hex digit 0-9, A-F, a-f)
char asciihex2bin(char ascii)
{
if (ascii > 0x40) ascii += 9;
return (ascii & 0x0F);
}
ponedelnik 0 Newbie Poster
Recommended Answers
Jump to PostDid you mean ... a short hex char to int conversion ?
// ascii_hex_char_2_int.cpp // // http://developers-heaven.net/forum/index.php/topic,46.0.html #include <iostream> #include <string> using namespace std; /* 48 060 30 00110000 0 49 061 31 00110001 1 50 062 32 00110010 2 51 063 33 00110011 …
All 3 Replies
David W 131 Practically a Posting Shark
David W 131 Practically a Posting Shark
ponedelnik 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.