HIDdata commandline with error any OS?

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
Ronny

HIDdata commandline with error any OS?

Post by Ronny » Wed Nov 05, 2008 12:18 am

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?!

Ronny

HIDdata commandline with error any OS?

Post by Ronny » Wed Nov 05, 2008 12:23 am

found in 20081022

i have changed in Basis 16 then examle was ok.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Wed Nov 05, 2008 1:08 pm

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.

Post Reply