Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_corelib_io_qtextstream.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
5QFile data("output.txt");
8 out << "Result: " << qSetFieldWidth(10) << left << 3.14 << 2.7;
9 // writes "Result: 3.14 2.7 "
10}
12
13
17while (stream.readLineInto(&line)) {
18 ...
19}
21
22
24QTextStream in("0x50 0x20");
26
27in >> firstNumber; // firstNumber == 80
28in >> dec >> secondNumber; // secondNumber == 0
29
30char ch;
31in >> ch; // ch == 'x'
33
34
36int main(int argc, char *argv[])
37{
38 // read numeric arguments (123, 0x20, 4.5...)
39 for (int i = 1; i < argc; ++i) {
40 int number;
41 QTextStream in(argv[i]);
42 in >> number;
43 ...
44 }
45}
47
48
52in >> str;
54
55
59out.setFieldWidth(10);
60out.setFieldAlignment(QTextStream::AlignCenter);
61out.setPadChar('-');
62out << "Qt" << "rocks!";
64
65
67----Qt------rocks!--
69
70
73QChar ch1, ch2, ch3;
74in >> ch1 >> ch2 >> ch3;
76
77
79QTextStream out(stdout);
80out << "Qt rocks!" << Qt::endl;
82
83
85stream << '\n' << Qt::flush;
\inmodule QtCore
\inmodule QtCore
Definition qfile.h:93
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
int main()
[0]
Definition qcompare.h:63
QTextStream & flush(QTextStream &stream)
Calls QTextStream::flush() on stream and returns stream.
QTextStream & endl(QTextStream &stream)
Writes '\n' to the stream and flushes the stream.
EGLStreamKHR stream
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint left
GLdouble s
[6]
Definition qopenglext.h:235
GLuint in
QTextStreamManipulator qSetFieldWidth(int width)
QFile file
[0]
QString str
[3]
QTextStream out(stdout)
[7]
out<< "Qt"<< "rocks!";----Qt------rocks!--QTextStream in(file);QChar ch1, ch2, ch3;in > ch1 ch2 ch3
QFile data("output.txt")
[0]
QString s
[4]
QTextStream in("0x50 0x20")
[1]
QTextStream stream(stdin)
[0]