Page 1 of 1

Probem with swprintf on x86

PostPosted: Jun 20, 2003 @ 6:52am
by fzammetti

PostPosted: Jun 20, 2003 @ 6:56am
by fzammetti

PostPosted: Jun 20, 2003 @ 5:13pm
by Guest

PostPosted: Jun 20, 2003 @ 5:19pm
by Dan East

PostPosted: Jun 20, 2003 @ 5:31pm
by Dan East

PostPosted: Jun 20, 2003 @ 7:03pm
by Guest
Maybe I misread his intention then. I was under the impression that he wanted to write portable code between the PC and the PocketPC so that he wouldn't have to have separate code for each and surround the code in #ifdefs. Using TCHAR arrays and the "tchar" version of the library routines (such as _stprintf) will do this and they are designed exactly for this purpose.

TCHAR outStr[32];

_stprintf(outStr, TEXT("%d"), countdown_seconds);


That code will work on the PocketPC and the PC. No muss - no fuss. That is what I thought he was asking how to do.

Sometimes I find the most difficult part of providing help to people on this site is actually understanding what they are trying to do.

PostPosted: Jun 20, 2003 @ 7:35pm
by Kzinti

PostPosted: Jun 20, 2003 @ 8:43pm
by fzammetti
Anonymous was correct in what I was asking...

What I coded last night worked and was simply this:

TCHAR outStr[4];
#ifdef _WIN32_WCE
swprintf(outStr, L"%d", countdown_seconds);
#else
sprintf(outStr, "%d", countdown_seconds);
#endif

I wanted to be able to code it so that I didn't need the #ifdef's. His answer was precisely correct, I just tried it, and was precisely what I was looking for.

As for communication issues, try getting eight months into developing a major project and find out that someone didn't communicate the specs properly for one of the primary screens of the system. That has happened to me, and that's not unique in the industry. If someone misunderstands me here, big f'ing deal, no harm no foul. Other places though, it's, shall we say, somewhat worse?!?

PostPosted: Jun 20, 2003 @ 11:31pm
by refractor

PostPosted: Jun 21, 2003 @ 12:12am
by fzammetti