[En-Nut-Discussion] Static char array return problem

ivesworking ivesworking at hotmail.com
Wed Jul 12 20:32:50 CEST 2006


to simplify eeprom calling, i use this function

 char *eRString(u_int add,u_int range){
   int i;
   static char buffer[33];
 for(i=0;i<range;i++)
            buffer[i]=eeprom_read_byte((void *) (add+i));
 buffer[range]=0;
  return buffer;
 }

however when i start repeat calling this function, something when wrong

when i call the with fprintf

 fprintf(stream,"1:%s,2:%s,eRString(erom11,16),eRString2(erom12,32));

it seem the second string on printf  repeat  the result of 
eRString(erom11,16)

any idea what is wrong on my program ? or gcc or some pointer problem ?

wfloh




More information about the En-Nut-Discussion mailing list