아래처럼 해결 하면 된다.. 쿄쿄
VS.Net 2005에서 사용해본 결과 기본적으로 'LPWSTR' 타입을 사용하고 있었으므로..
wchar_t * pExeFile = ...;
wchar_t * pModuleFile = ...;
swprintf(pExeFile, L"%s", pModuleFile);
이처럼 하는게 좋을 거 같다..
swprintf(pExeFile, L"%s", pModuleFile);
위 부분에서 L을 빼먹으면 또 에러가 나니 조심...
char * pExeFile = ...;
char * pModuleFile = ...;
sprintf(pExeFile, "%s", pModuleFile);
or
wchar_t * pExeFile = ...;
wchar_t * pModuleFile = ...;
swprintf(pExeFile, L"%s", pModuleFile);
or
#include <TCHAR.h>
. . .
LPCTSTR pExeFile = ...;
LPCTSTR pModuleFile = ...;
_stprintf(pExeFile, _T("%s"), pModuleFile);
or a mixture:
wchar_t * pExeFile = ...;
char * pModuleFile = ...;
swprintf(pExeFile, L"%hs", pModuleFile);
or
char * pExeFile = ...;
wchar_t * pModuleFile = ...;
sprintf(pExeFile, "%ws", pModuleFile);
// char -> wchar
/////////////////////////////////////////////////////////////////////
void CharToWChar( wchar_t* pwstrDest, const char* pstrSrc )
{
int nLen = (int)strlen(pstrSrc)+1;
mbstowcs( pwstrDest, pstrSrc, nLen);
}
// wchar -> char
/////////////////////////////////////////////////////////////////////
void WCharToChar( char* pstrDest, const wchar_t* pwstrSrc )
{
int nLen = (int)wcslen(pwstrSrc);
wcstombs(pstrDest, pwstrSrc, nLen+1);
}
'MISCELLANEOUSNESS' 카테고리의 다른 글
MFC 프로그래밍 설명 문서... (0) | 2008.01.10 |
---|---|
[C/C++] 윈도우즈 프로그래밍 자주 쓰는 접두어들 (2) | 2008.01.10 |
미래사회 10대 트렌드 (0) | 2008.01.07 |