#include <QFile> #include <QTextStream> int main() { QFile file("out.txt"); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) return 1; QTextStream out(&file); out << "The magic number is: " << 49 << "\n"; }