Qt之QString与wchar_t 互相转换

1、代码

wchar_t *QString2Wchar(QString buf)
{
    return (wchar_t*)reinterpret_cast<const wchar_t *>(buf.utf16());
}


QString Wchar2QString(wchar_t *buf)
{
    return QString::fromWCharArray(buf);
}

参考:https://blog.csdn.net/qq_45662588/article/details/123799322

posted @ 2022-05-25 17:49  朱小勇  阅读(392)  评论(0编辑  收藏  举报