//获取路径
const char* CStr = "C:\\Users\\MFGYF-LiPan\\Desktop\\文件属性\\123_A.par";
size_t len = strlen(CStr) + 1;
size_t converted = 0;
wchar_t* WStr;
WStr = (wchar_t*)malloc(len * sizeof(wchar_t));
mbstowcs_s(&converted, WStr, len, CStr, _TRUNCATE);
//获取参数
char argu[] = "-get";
size_t len2 = strlen(argu) + 1;
size_t converted2 = 0;
wchar_t* WStr2;
WStr2 = (wchar_t*)malloc(len2 * sizeof(wchar_t));
mbstowcs_s(&converted, WStr2, len2, argu, _TRUNCATE);
//初始化路径和参数
wchar_t** wArgs = new wchar_t* [2] {WStr, WStr2};
argc =2;
PCWSTR pszAppName = CONSUME_NEXT_ARG(wArgs, argc);
PCWSTR pszOp = CONSUME_NEXT_ARG(wArgs, argc);
wprintf(pszAppName);
wprintf(L"\n");
wprintf(&pszOp[0]);
wprintf(L"\n");
system("pause");
return 0;
wchar_t* argv[] 数组赋值
最新推荐文章于 2024-06-27 09:36:44 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)