xboxscene.org forums

Author Topic: Going From Short To Wchar  (Read 46 times)

Dents

  • Archived User
  • Newbie
  • *
  • Posts: 6
Going From Short To Wchar
« on: September 22, 2004, 10:27:00 AM »

CODE

wchar_t buf[40];
wsprintfW(buf, L"Resolution: %lu by %lu", dm.Width, dm.Height);

Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
Going From Short To Wchar
« Reply #1 on: September 22, 2004, 11:18:00 AM »

I use a modified version of CStdString (from CodeProject) in MXM to handle conversion back and forth.

Also, as good practice, use _T() around quoted text and character literals, as well as _txxxx functions.

The CStdString template makes things a bit easier, since there's no CString for the XDK, but you also have to remember that when using parameters in printf()-style formatting calls, with multiple arguments, to explicitly use the .c_str() operator of the string, to force the conversion to the proper type.
Logged

blueshogun96

  • Archived User
  • Sr. Member
  • *
  • Posts: 395
Going From Short To Wchar
« Reply #2 on: September 28, 2004, 11:18:00 AM »

mad.gif

EDIT: Nevermind, I fixed it.  Sorry for bumping this thread
Logged