if (ceRecord.note != NULL)
{
}
When I drop into the debugger and look at what ceRecord.note is, it is "".

Why is my if statement failing?

Try taking the address of NULL, that should shake the grey cells a bit ;-) There is a world of difference between NULL and "", and indeed, in your case a world of pain as well!

"" is a string! Admittedly it has zero length according to StrLen(), but in fact it has a real length of 1(one) char, the value of that char is zero, 0, \0, NULL, nadda, whatever. Assuming that ceRecord.note is typed as char*, then your test fails because ceRecord.note IS NOT NULL, it is pointing a a piece of memory that contains a zero length string. Therefore it will NOT be NULL.

I remember getting stymied a few times way back when learning Smalltalk. Thank god it was all over before Java became flavour of the month!

Sean Charles.


--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to