Does the "hello" dir exists ? If not, you will probably get QFile::OpenError when trying to create a file in a non-existing directory.
You need to check return values, they can help a lot:
QFile Druck_m
(str
+"Druck.m");
...
} else{
qDebug() << "file not opened, error code: " << Druck_m.error(); // error codes are desribed in QFile documentation
}
QString str = QCoreApplication::applicationDirPath()+"/hello/";
QFile Druck_m(str+"Druck.m");
if( Druck_m.open(QIODevice::WriteOnly) ){
QTextStream dataDruck_m(&Druck_m);
...
} else{
qDebug() << "file not opened, error code: " << Druck_m.error(); // error codes are desribed in QFile documentation
}
To copy to clipboard, switch view to plain text mode
Bookmarks