תראה, תשמע..
הנה הוצאתי לך את אחת מפונקציות ההמרה שיש ב-DirectX AppWizard, שים לב:
VOID DXUtil_ConvertWideStringToAnsi( CHAR* strDestination, const WCHAR* wstrSource, int cchDestChar ) { if( strDestination==NULL || wstrSource==NULL ) return; if( cchDestChar == -1 ) cchDestChar = wcslen(wstrSource)+1; WideCharToMultiByte( CP_ACP, 0, wstrSource, -1, strDestination, cchDestChar-1, NULL, NULL ); strDestination[cchDestChar-1] = 0; }
מה הלקח הנלמד ?? תשתמש ב-WideCharToMultiByte. יש ?
ל-AppWizard שמסופק עם ה-SDK יש כמה פונקציות עזר נחמדות, כמו לדוגמא המרת מחרוזות בין WCHAR, TCHAR ו-ANSI או UNICODE (תלוי איזה מהם מוגדר).