Hey Im starting out in C just recently and Im needing a string that converts binary to text, The only way i know of doing this without knowledge of C entirely. Is Making a sorta of library of the entire alphabet in binary for the program to select the text from it to display a sentence. If that makes any sense, anyways any help would be appreciated as would some tutorials on these matters.
nope just a hobby i graduated from school later year.
here is one way - using strtol()
#include <stdlib.h>
/* assume two hex chars per ascii value */
void hex2ascii(char *dest, char *src){
char tmp[4]={0x0};
char **ptr=NULL,
*buf=dest;
*buf=0x0;
if(*src){
for(int i=0;src;i+=2){
strncpy(tmp,&src,2);
sprintf(tmp,"%c",strtol(tmp,ptr,16) );
*buf++=tmp[0];
}
}
*buf=0x0;
}
You can also use sscanf().