Do you have any algorithms I can look at that will perform escape logic on a base64 and hex encoded message? Thanks

mind explaining what you are talking about?

I apologize. My initial post was not very clear. I have an ascii string that contains escape sequences in their Hex representation. I need to handle these Hex escape sequences and need an algorithm that will do this. For example, if I ahve the following string

My name is John \7C.

I want to be able to escape the \7C and replace it with its ascii representation which is a |

If you have an algorithm that can process Hex escape sequences, that would be great...


shouldn't be difficult -- search for '\' and if found assume remaining word is a hext digit. you can use strtol() to convert to a long and typecast to char.

char *ptr;
char hex[] = "7C";
long n = strtol(hex,&ptr,16);
cout << (char)n;
// or to convert back to a string
char buf[255];
sprintf(buf,"My name is John %c", (char)n);

Thanks. I will try that.

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.