QT 向txt中写入数据
程序员文章站
2022-03-31 19:24:46
...
QDir *TEST = new QDir(QDir::currentPath());
bool exist = TEST->exists("Signal");
if(!exist)
{
TEST->mkdir("Signal");
}
QString fileNameGPS = "Signal/GPS.txt";
QFile fileGPS(fileNameGPS);
if(!fileGPS.open(QIODevice::WriteOnly|QIODevice::Text))
{
QMessageBox::warning(this,"sdf","can't open",QMessageBox::Yes);
}
QTextStream in(&fileGPS);
for (int i=0;i<g_GNGSV->GPGSVAvgSNRList.length();i++)
{
double GPSDB= g_GNGSV->GPGSVAvgSNRList.at(i);
//处理读取文件的信噪比为空的情况
if(GPSDB<0.1)
{
in<<QString::number(GPSDB)+"\r\n";
}
else
{
in<<"NaN"<<"\r\n";
}
}
上一篇: 生活小妙招 虾的营养价值 辨别虾的新鲜度
下一篇: QT--QlistView 简单应用