Page 1 of 1

HIDdata commandline with error any OS?

Posted: Wed Nov 05, 2008 12:18 am
by Ronny
I have testet and no luck with it, than i searched in the Code and than that!

Code: Select all

static int  hexread(char *buffer, char *string, int buflen)
{
char    *s;
int     pos = 0;

    while((s = strtok(string, ", ")) != NULL && pos < buflen){
        string = NULL;
        buffer[pos++] = (char)strtol(s, NULL, 0);
    }
    return pos;
}


buffer[pos++] = (char)strtol(s, NULL, 0);
will it ever give 0 in the buffer?!

HIDdata commandline with error any OS?

Posted: Wed Nov 05, 2008 12:23 am
by Ronny
found in 20081022

i have changed in Basis 16 then examle was ok.

Posted: Wed Nov 05, 2008 1:08 pm
by christian
When the basis is set to 0, strtol() determines the basis from the number's prefix. If it's 0..., then the number is interpreted as octal, if it's 0x..., then as hex and if it's any other digit then it must be decimal.