At 04:40 AM 11/26/2003, KEN wrote:
well I thought UInt16 should be ranged from 0 to 65535, but when I use CW to
test, it seems not the case. It seems that UInt16 is equal to Int16 which
is -32767 to 32767, why?

I use the following codes to test

#define abort_int(msg, int) { \
char outStr2[128]; \
StrPrintF(outStr2, msg, int); \
ErrDisplayFileLineMsg(__FILE__, __LINE__,outStr2); \
}

UInt16 intVal;

intVal = 60000;
abort_int("%d", intVal);    // the value shown is -5536 which is wrong

%d's range is Int16. You need to use %ld and cast intVal to Int32 or use %u which assumes UInt16.


--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com



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

Reply via email to