Tyler Kellen wrote:
char string[] = "1d,4c,20,00";
char target[] = {0x1d,0x4c,0x20,0x00};
char buf[64];
I have searched newgroups and am actively searching online for a
function to take the value of string and place it into buf so that buf
== target.
Sounds quite like homework for me.
Give us your code or ideas and we will help you improve it/
find errors or possible sources of errors.
Functions which may help you writing the code:
strtoul(), sscanf(). For general separator handling, use a
string (e.g. char separators[]=",; ") and strchr() when parsing
string.
Or do it by hand, extracting the hex digits of one number
and converting it yourself.
Note: Hex expressions usually denote nonnegative numbers,
so
unsigned char target[] = {0x1d,0x4c,0x20,0x00};
unsigned char buf[64];
may be more appropriate.
Cheers
Michael
--
E-Mail: Mine is a gmx dot de address.