Problem compare byte



hello
i'm using library "idxrfidreader.h"
i have compare bed badge master not work
after print badge equal (point2)
but  if (tagtoprint == tag1) not work

help me


code: [select]



void printtag(byte *tagtoprint)

{
 serial.println("read badge");
  for(int i=0; i<5; i++) {
     serial.print(tagtoprint[i]);
  }
       serial.println("master badge");
     for(int i=0; i<5; i++) {
     serial.print(tag1[i]);
  }

// point2

   if (tagtoprint == tag1)
  {
      serial.println("ok");

  }

}

1. perché scrivi in inglese nella sezione italiana del forum ? ? ? :o

2. in 'c' non puoi comparare con == due stringhe classiche (char array), ma devi usare le funzioni che trovi nella avr libc (... sempre automaticamente inclusa dal ide), in <string.h> ed, in particolare, la strcmp().

eventualmente, seconda dei casi, guarda anche la memcmp().

guglielmo

p.s.: dedica del tempo studiarti la avr libc, è piena di funzioni utilissime.


Arduino Forum > International > Italiano > Software (Moderator: leo72) > Problem compare byte


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts