On Sat Oct 16, 2004 at 16:21:04 +1000, Lucas King wrote: >hello, > >how does one compare two structures of the same type? > >Anjuta is returning an error when i compile : > if (sin1 == sin2) { > .. > .. > } > >where sin1 and sin2 are structures of the same type. the sin structure >is sockaddr_in. > >thanking you in advance,
You need to either compare each element, or use memcp; eg: if (memcmp(&sin1, &sin2, sizeof sin1) == 0) { } Benno -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html