From: Manuel B. <web...@ma...> - 2001-10-06 18:12:52
|
Hi! I've some code here. Compiled with an old 2.2 CVS Version it worked quite well. Today I recompiled it with the CVS Version from yesterday, but the code isn't doing what it should do... So, I backtraced where (one?) problem is. I have a function void exec_command (unsigned char *command) where command is a command that has been retrieved via SS0 on my 80C537. Then the command is recognized via some if (strncmp(command, "BLABLA", 6) == 0) statements. One command is "SET VOLUME 1" where 1 is the channelnumber. Then I convert this number with chan = atoi(&command[9]); atoi is the following (a bit modified from the original) code: -- snip -- unsigned char atoi(unsigned char * s) // modified code, that only includes what's needed by my routines { unsigned char rv=0; // skip till we find a digit while (*s) { if (*s <= '9' && *s >= '0') break; s++; } while (*s && *s >= '0' && *s <= '9') { rv = (rv * 10) + (*s - '0'); s++; } return (rv); } -- /snip -- The problem is that atoi always returns a zero! But when I send "SET VOLUME 01" it returns 1. Quite strange... I played a bit around with &command[9] as the argument... What am I doing wrong? As I told, with 2.2 from CVS it worked! Ciao, Manuel -- ('> http://www.matronix.de <`) //\ http://www.e-online.de/public/borchers /\\ V_/_ PGP-Key: www.matronix.de/manuel_borchers.asc Key-ID:832FFAFE _\_V ======= written on an i686 running RedHat 7.1 with kernel 2.4.10 ====== |