//String以GBK编码格式转Ascii
inline QByteArray String2Ascii(QString str){
QTextCodec *pCodec = QTextCodec::codecForName( "GBK" );
QByteArray data = pCodec->fromUnicode(str);
return data;
}
//把ascii字符数组以GBK编码格式转QString
inline QString Ascii2String(const char *asciichar,int length)
{
QByteArray dd= QByteArray::fromRawData(asciichar,length);
QString uc=QTextCodec::codecForName("GBK")->toUnicode(dd);
uc.remove(QChar::Null);
return uc;
}