首页 > 代码库 > QString->string->wstring->LPCWSTR

QString->string->wstring->LPCWSTR

QFileInfo info("./records.db");std::string str = info.absoluteFilePath().toStdString(); //将QString转换为stringstd::wstring wstr(str.length(), L‘ ‘);  //初始化宽字节wstrstd::copy(str.begin(), str.end(), wstr.begin());  //将str复制到wstrLPCWSTR path = wstr.c_str();  //将wstr转换为C字符串的指针,然后赋值给path

转换过程:QString->string->wstring->LPCWSTR

http://www.cnblogs.com/luoxiang/p/5456173.html

QString->string->wstring->LPCWSTR