firemail
标题: QT base64编解码 [打印本页]
作者: firemail 时间: 2017-1-12 15:52
标题: QT base64编解码
Qt中,
QByteArray QByteArray::toBase64() const //Returns a copy of the byte array, encoded as Base64.
例:
编码:
QByteArray text("Qt is great!");
text.toBase64(); // returns "UXQgaXMgZ3JlYXQh"
解码:
QByteArray bytearrayfrombase64 = QByteArray::fromBase64( bytearray.toBase64() );
MessageBoxQ( bytearrayfrombase64 ); // 显示编码的字符串;
QByteArray tempArray = QByteArray::fromBase64(message.mimeContent().toLatin1());
欢迎光临 firemail (http://www.firemail.wang:8088/) |
Powered by Discuz! X3 |