C++ Popen utf8路径
当我想用\u popen打开一个utf8路径时,我遇到了一个问题 这是我的代码:C++ Popen utf8路径,c++,gcc,utf-8,C++,Gcc,Utf 8,当我想用\u popen打开一个utf8路径时,我遇到了一个问题 这是我的代码: char buf1520[1500]; string testme; const char * sroot2 = getenv ("systemroot"); string md5cmd2 = sroot2; md5cmd2 += "\\System32\\certutil -hashfile "; md5cmd2 += "C:\\Users\\Vuzee\\Desktop\\testč\\test.jar"; c
char buf1520[1500];
string testme;
const char * sroot2 = getenv ("systemroot");
string md5cmd2 = sroot2;
md5cmd2 += "\\System32\\certutil -hashfile ";
md5cmd2 += "C:\\Users\\Vuzee\\Desktop\\testč\\test.jar";
cout << md5cmd2 << endl;
md5cmd2 += " MD5";
const char* md5cmdnovo2 = md5cmd2.c_str();
FILE *p1502 = _popen(md5cmdnovo2, "r");
for (size_t count; (count = fread(buf1520, 1, sizeof(buf1520), p1502));)
testme += string(buf1520, buf1520 + count);
_pclose(p1502);
cout << "HASH:" << testme << endl;
cin.ignore();
您的应用程序可以将字符串存储为UTF-8,但Windows操作系统有两种应用程序接口-都不是UTF-8 您可以使用处理
wchar\u t
(宽字符)的函数使应用程序正常工作。首先,您必须将md5cmd2
中的string
值转换为宽字符串(转换为char*
将不起作用)
进一步阅读:
HASH:CertUtil: -hashfile command FAILED: 0x80070003 (WIN32: 3)
CertUtil: The system cannot find the path specified.