by mlepage » Apr 17, 2004 @ 9:59pm
Are there any gotchas to using _stprintf on Palm?
Here's my situation. Things seem to be working now in my own application, but a few images aren't showing. I tried to collect all the HRESULTs from CreateSurface into an array to print out, to see what the problem is.
For the 19 images I see the HRESULTs like this:
0 0
0 1
0 2
0 3
and so on until
0 18
So it appears that all images are created with result 0 which is OK.
However, the weird thing is, that the numbers are printed in reverse. The first number should be the index, the second should be the result. My print looks like this:
_stprintf(str, TEXT("%d, %d"), n, hresultarray[n]);
Why would this occur? I know that function argument order of evaluation is undefined, but why would the order be incorrect even in the function itself?
Further, the fact that the images seem to be created OK sheds no light on the mystery of why they aren't showing for me. (Only some images, not all.)
OK, I printed just the result and two images return -32761 which I assume is out of memory. But why isn't %d OK for printing ints? It seems like %d wants two bytes but the int is four bytes, or something like that, which would explain the weird prints the first time.
Also, the images that don't load are the images that don't display, but there are still some images that did load but don't display. Actually, it's a font. The image created OK, but one font isn't working.
I'll look into things some more. Most everything else seems to be working. There are some rough edges, and of course, the issues with performance and image size, but on the whole things look promising.
Oh one more thing, on my Tungsten E, this program takes 33s to get by the GapiDraw splash screen (creating images and everything). There are only 19 images, about half under 20KB, the rest under 90KB, except one is 206KB. It's not a very big program, altogether it builds a PRC file that is 510KB.