QString wc_createdata = QFileDialog::getSaveFileName(NULL, QString::fromLocal8Bit("生成报告"), tr(".csv")); if (wc_createdata.at(wc_createdata.size()-1)=='v' && wc_createdata.at(wc_createdata.size() - 2) == 's' && wc_createdata.at(wc_createdata.size() - 3) == 'c') { wc_createdata = wc_createdata; } else { wc_createdata = wc_createdata + ".csv"; } QFile wc_creatfile(wc_createdata); if (wc_creatfile.open(QIODevice::ReadWrite)) { wc_creatfile.write("sd ljlkjkjlkds "); //写入的内容 } wc_creatfile.close();
标签:文件,wc,路径,creatfile,保存,createdata,size From: https://www.cnblogs.com/RedWetPlace/p/16825096.html