36 lines
865 B
C++
36 lines
865 B
C++
|
#include "PrintMsgToQDebug.h"
|
|||
|
#include <QDebug>
|
|||
|
BASECONSTVARIABLEAPI void PrintMsgToQDebug(char* msg)
|
|||
|
{
|
|||
|
qDebug() << QString(msg);
|
|||
|
return ;
|
|||
|
}
|
|||
|
|
|||
|
BASECONSTVARIABLEAPI void PrintfToQDebug(const char* msg)
|
|||
|
{
|
|||
|
qDebug() << QString(msg);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
BASECONSTVARIABLEAPI void PrintTipMsgToQDebug(const char* tip, const char* msg)
|
|||
|
{
|
|||
|
qDebug() <<QString(tip)<<"\t:\t" << QString(msg);
|
|||
|
return;
|
|||
|
}
|
|||
|
// <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD> printf <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
BASECONSTVARIABLEAPI void printfinfo(const char* format, ...) {
|
|||
|
char buffer[256]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 256 <20>ֽ<EFBFBD>
|
|||
|
va_list args;
|
|||
|
|
|||
|
// ʹ<><CAB9> va_start <20><>ȡ<EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
|||
|
va_start(args, format);
|
|||
|
|
|||
|
// ʹ<><CAB9> vsnprintf <20><><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>д<EFBFBD><D0B4> buffer
|
|||
|
vsnprintf(buffer, sizeof(buffer), format, args);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD>ʹ<EFBFBD><CAB9>
|
|||
|
va_end(args);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD> PrintfToQDebug
|
|||
|
PrintfToQDebug(buffer);
|
|||
|
}
|