At 01:15 PM 8/29/2003, someog wrote:
I'm seeing major problems with the newest emulator, v3.5, which I wasn't seeing
with whatever version of the emulator I had before. I think it was 3.1. Some
very simple code snippets can illustrate the problems.

I answered this same question on pilot.programmer. The problem is that you're using 4-byte integers, which aren't really compatible with the variable argument list convention that Palm OS functions use. The solution: use %ld in your format strings, or go back to 2-byte ints.


PROBLEM 1:

short nLen = 32;
HostFPrintF(HostLogFile(), "%d", nLen);

This prints 0 to the logfile. Similarly,

short nLen = 32;
char tmp[200];
StrPrintF(tmp, "%d", nLen)

...puts "0" in tmp.  Why isn't the short being correctly formatted?  Using a
format specifier of %hd doesn't help.


PROBLEM 2:


This code crashes the emulator. Why? The previous version didn't crash.

char tmp[200];
StrPrintF(tmp, "%d %s", 18, "BOO");

The equivalent construct using HostFPrintF(HostLogFile()) also crashes.

Anyone know of a decent workaround?

Thanks,
David



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

--
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