What I want to do is to put this into 1 long string i.e. "012DC5B8000000BC". Thinking this would be an easy way to check whether it was valid against stored serial numbers using strcmp.
I am trying the following but only get '0's in cString1.
for(i=0;i<8;++i) // Set i between 0 & 8
{
buffer[i]=touch_read_byte(); // Read 8 bytes of button data * Works *
sprintf(cString,"%c",buffer[i]); // Convert to string
strcat(cString1,cString); // Concatenate s2 onto s1
}
Any pointers where i'm going wrong or even simpler methods
Using PIC16F877A
compiler version 4.110.
Thanks in advance
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Thu Dec 01, 2011 5:25 pm
If you want to convert binary to ascii hex. Use "%x", not "%c".
This is in the manual. See the printf section.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum