PDA

View Full Version : Create File with QFile



wirasto
19th April 2013, 20:20
How to force create path if it not exists with QFile?



QFile f("/tmp/this/path/is/not/exists/test.php");
if (!f.open(QIODevice::WriteOnly|QIODevice::Truncate) ) {
qDebug() << "Gagal:" << f.errorString();
}

amleto
19th April 2013, 21:35
presume you do not have rights to create a file there?

ChrisW67
19th April 2013, 23:17
How to force create path if it not exists with QFile?

QFile creates files not directories. Look at QDir::makePath()