0
当我想开一家UTF8路径与_popenPOPEN 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";
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();
在此COUT afther路,我得到这个输出:C:\Windows\System32\certutil -hashfile C:\Users\Vuzee\Desktop\testÄ\test.jar
所以我认为问题是因为字符串不能保存UTF8字符,所以我怎么能解决这个问题,并在popen中调用它?
和去年COUT我得到:
HASH:CertUtil: -hashfile command FAILED: 0x80070003 (WIN32: 3)
CertUtil: The system cannot find the path specified.
什么让你觉得UTF-8应的Windows API曾经工作吗? –
在进行文件系统调用之前,您需要将UTF-8转换为UTF-16 LE。 –