Qt 文件讀寫相關

參考文檔

QFileInfo : The QFileInfo class provides system-independent file information.

QFile : The QFile class provides an interface for reading from and writing to files.

筆記內容

Tips : "./data/*"  //Debug目錄 或 Release目錄外有效

str = QString("./data.txt");
qDebug()<<str;
QFile file = QFile(str);
QFileInfo fileinfo = QFileInfo(str);
if( !file->open(QFile::ReadOnly) ){
	qDebug()<<"error";
	qDebug()<<file.exists();
	qDebug()<<file.error();
	qDebug()<<file.errorString();
	qDebug()<<fileinfo.absoluteFilePath();
	return false;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章