函数原型如下:
QString QFileDialog::getSaveFileName ( QWidget * parent = 0, const QString & caption = QString(), const QString & dir = QString(), const QString & filter = QString(), QString * selectedFilter = 0, Options options = 0 )
返回用户选择的文件保存路径,然后自己将文件放在QString所代表的路径中
举个例子:
QString filename=QFileDialog::getSaveFileName(this,tr("save license"),tr("abc.txt"));
QByteArray ba = filename.toLatin1();
char* Filename = ba.data(); //将QString装换为char*
FILE* pFile = fopen(Filename,"wb");
fwrite(---,---,---,pFile);
fclose(pFile);