QFile outFile("test.txt");QTextStream stream(&outFile); for (int j=1;j<40;j++) { sp.sprintf("%i",j); stream << sp ; }
stream << sp << '\r';
#if defined(Q_WS_WIN) // в WINDOWS stream << sp <<"\r\n";#else // другие ос stream << sp <<"\n";#endif
QFile data("output.txt"); if (data.open(QFile::WriteOnly | QFile::Truncate)) { QTextStream out(&data); out << "Result: " << qSetFieldWidth(10) << left << 3.14 << 2.7 << endl; // writes "Result: 3.14 2.7 \n" }