-
-
Save ashumeow/a229d90d5b0d2301520b1ea1941c6407 to your computer and use it in GitHub Desktop.
create file of text in Qt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void MainWindow::createfile(){ | |
QString filename="test.txt"; | |
QFile file(filename); | |
if(!file.exists()){ | |
qDebug() << "NO existe el archivo "<<filename; | |
}else{ | |
qDebug() << filename<<" encontrado..."; | |
} | |
QString mesg="una segunda linea"; | |
if (file.open(QIODevice::WriteOnly | QIODevice::Text)){ | |
QTextStream out(&file); | |
out << "archivo de texto generado en Qt\n"; | |
out<<mesg; | |
file.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment