QFileInfo info("./records.db"); std::string str = info.absoluteFilePath().toStdString(); //将QString转换为string std::wstring wstr(str.length(), L‘ ‘); //初始化宽字节wstr std::copy(str.begin(), str.end(), wstr.begin()); //将str复制到wstr LPCWSTR path = wstr.c_str(); //将wstr转换为C字符串的指针,然后赋值给path
转换过程:QString->string->wstring->LPCWSTR
http://www.cnblogs.com/luoxiang/p/5456173.html
时间: 2024-10-14 07:04:29