This is my first program in C++. I have written this same program in vb already. This seems like it should be very simple. I have this bit of code.
unsigned char hdr[2];
//the hdr array gets filled from another array
int i
for(i=0 ; i<2 ; i++)
{
fprintf(logfile, " %02", (unsigned int)hdr[i]);
}
This code will write something like "55BB" to the log file. Which is great, I am looking for "55BB". But what I really need is "55BB" in a string variable and not written to the log file. Funny thing is that I know 2 people that are C++ "experts" and this seems like a very difficult question. They always come back with more questions and no answers. Hopefully someone here will be able to help.
that did work. Thanks. But now I realize that my result needs to be in hex. I got a result of 85 187, when what I really need is 55 BB. I guess that would be another topic. I will google that and see if I can come up with an answer.
He has a two variables: unsignedchar hdr[2];. One holds value of 85 (0x55) and second holds 187 (0xBB). He vants those to be printed in hex without separating space. That is all.
That is correct MiiNiPaa. But I just went ahead and compared to 85 and 187 instead of 55 and BB. I think it is really stupid and real C++ programers would probably laugh at my code, but it works.