IAR bug, vagy en vagyok a susu?

Vajk Fekete Vajk.Fekete at oracle.com
Wed Feb 11 09:48:07 CET 2004


lasd elozo levelem.

idezet a scanf man pagejabol:
       x      Matches  an  unsigned hexadecimal integer; the next
              pointer must be a pointer to unsigned int.
                                                        ^^^^^^^^^^^

es az unsigned int az 2 byte.

vajk



Fuzesi Arnold wrote:

>Ez mukodik:
>------------
>     if(comm_newcmd0){
>        if( comm_ibuf0[comm_ibuf0[2]-'@'] ==
>w1_crcgen((uchar*)&comm_ibuf0[0],comm_ibuf0[2]-'@') ) {
>          if( sscanf(comm_ibuf0,"<BMHP%5f%3u%*c",&temp_f,&temp_c)!=2 ) {
>            d_main->tmp=0,d_main->hum=0;
>            myprintf(SER1,"SHT scanf error\r\n");
>          }
>          d_main->tmp=temp_f;
>          d_main->hum=temp_c;
>        }
>        else {
>          myprintf(SER1,"SHT CRC error\r\n");
>        }
>        comm_newcmd0=0;
>      }
>
>Ez meg nem:
>------------
>      if(comm_newcmd0){
>        if( comm_ibuf0[comm_ibuf0[2]-'@'] ==
>w1_crcgen((uchar*)&comm_ibuf0[0],comm_ibuf0[2]-'@') ) {
>          if(
>sscanf(comm_ibuf0,"<BMHP%5f%3u%*c",d_main->tmp,d_main->hum)!=2 ) {
>            d_main->tmp=0,d_main->hum=0;
>            myprintf(SER1,"SHT scanf error\r\n");
>          }
>        }
>        else {
>          myprintf(SER1,"SHT CRC error\r\n");
>        }
>        comm_newcmd0=0;
>      }
>
>A scanf bugzik...Az a lenyeges sor.
>Ha egy strukturaelemre mutato pointeren keresztul irom a struktura elemet,
>akkor a kovetkezo strukturaelembe
>is belenyul (masodik variáció).
>Ha meg beteszem atmeneti valtozoba(első variácó), és utana toltom be, akkor
>oke minden.
>
>Az a gyanum, hogy a scanf körül van vmi galiba...Vagy én nem használom jól a
>formátumstringjét, vagy nemtom.
>Van valakinek tippje?
>
>Struktura maga:
>typedef struct {
>  float tmp;
>  uchar hum; -------------- a hum-ba ha ir a scanf, akkor a day-be is
>belenyul... :(
>  uchar day;  --------------
>  uchar time;
>  uint measured;
>  uint average;
>  uint predest;
>  uint piece;
>  uint weight;
> }D_MAIN;
>
>Arnold
>
>  
>



More information about the Elektro mailing list