积极答复者
获取命令行的字符转换问题

问题
-
LPWSTR *szArgList;
int argCount;
szArgList = CommandLineToArgvW(GetCommandLineW(), &argCount);
TCHAR szBuf(100);
strcpy(szBuf,(_bstr_t)szArgList[1]); //这里不知道怎么转换- 已编辑 Honny_yeyh 2012年1月28日 5:52
答案
-
WCHAR szBuf[100];
wcscpy(szBuf, szArgList[1]);
0xBAADF00D- 已标记为答案 Honny_yeyh 2012年1月29日 0:15
-
LPWSTR *CommandLineToArgvW(
LPCWSTR lpCmdLine,
int *pNumArgs
);它返回的是LPWSTR,所以下面与它相关的操作都是宽字符串操作的那些函数
wcscpy/swprintf...
Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.- 已标记为答案 Honny_yeyh 2012年1月29日 0:15
全部回复
-
用wcscpy代替strcpy
还有你那个buffer该用中括号
0xBAADF00D- 已编辑 VongerModerator 2012年1月28日 8:50
- 已标记为答案 Honny_yeyh 2012年1月28日 8:57
- 取消答案标记 Honny_yeyh 2012年1月28日 12:08
-
WCHAR szBuf[100];
wcscpy(szBuf, szArgList[1]);
0xBAADF00D- 已标记为答案 Honny_yeyh 2012年1月29日 0:15
-
LPWSTR *CommandLineToArgvW(
LPCWSTR lpCmdLine,
int *pNumArgs
);它返回的是LPWSTR,所以下面与它相关的操作都是宽字符串操作的那些函数
wcscpy/swprintf...
Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.- 已标记为答案 Honny_yeyh 2012年1月29日 0:15