summaryrefslogtreecommitdiffstats
path: root/examples/serialport/cwritersync/main.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2020-03-30 15:01:44 +0200
committerTopi Reinio <topi.reinio@qt.io>2020-04-06 10:32:07 +0200
commitff3fd7b0330cb76772066ce7162320f4dc1a5c28 (patch)
tree7fe2f0d11e600a6d0e7d375a781c30e7e7c30045 /examples/serialport/cwritersync/main.cpp
parentb30052fa41f6332f20ec440dcdbcd06b41a954f5 (diff)
Remove deprecated QTextStream operators from examplesv5.15.0-beta4
Use '\n' instead. Task-number: QTBUG-82532 Change-Id: I97aec4076bd46f23644099158f346a6ca32a4a0e Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'examples/serialport/cwritersync/main.cpp')
-rw-r--r--examples/serialport/cwritersync/main.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/examples/serialport/cwritersync/main.cpp b/examples/serialport/cwritersync/main.cpp
index 125c111c..0fd8fdc6 100644
--- a/examples/serialport/cwritersync/main.cpp
+++ b/examples/serialport/cwritersync/main.cpp
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
if (argumentCount == 1) {
standardOutput << QObject::tr("Usage: %1 <serialportname> [baudrate]")
- .arg(argumentList.first()) << endl;
+ .arg(argumentList.first()) << "\n";
return 1;
}
@@ -79,14 +79,14 @@ int main(int argc, char *argv[])
if (!serialPort.open(QIODevice::WriteOnly)) {
standardOutput << QObject::tr("Failed to open port %1, error: %2")
.arg(serialPortName).arg(serialPort.errorString())
- << endl;
+ << "\n";
return 1;
}
QFile dataFile;
if (!dataFile.open(stdin, QIODevice::ReadOnly)) {
standardOutput << QObject::tr("Failed to open stdin for reading")
- << endl;
+ << "\n";
return 1;
}
@@ -97,7 +97,8 @@ int main(int argc, char *argv[])
standardOutput << QObject::tr("Either no data was currently available on "
"the standard input for reading, or an error "
"occurred for port %1, error: %2")
- .arg(serialPortName).arg(serialPort.errorString()) << endl;
+ .arg(serialPortName).arg(serialPort.errorString())
+ << "\n";
return 1;
}
@@ -105,21 +106,25 @@ int main(int argc, char *argv[])
if (bytesWritten == -1) {
standardOutput << QObject::tr("Failed to write the data to port %1, error: %2")
- .arg(serialPortName).arg(serialPort.errorString()) << endl;
+ .arg(serialPortName).arg(serialPort.errorString())
+ << "\n";
return 1;
} else if (bytesWritten != writeData.size()) {
standardOutput << QObject::tr("Failed to write all the data to port %1, error: %2")
- .arg(serialPortName).arg(serialPort.errorString()) << endl;
+ .arg(serialPortName).arg(serialPort.errorString())
+ << "\n";
return 1;
} else if (!serialPort.waitForBytesWritten(5000)) {
standardOutput << QObject::tr("Operation timed out or an error "
"occurred for port %1, error: %2")
- .arg(serialPortName).arg(serialPort.errorString()) << endl;
+ .arg(serialPortName).arg(serialPort.errorString())
+ << "\n";
return 1;
}
standardOutput << QObject::tr("Data successfully sent to port %1")
- .arg(serialPortName) << endl;
+ .arg(serialPortName)
+ << "\n";
return 0;
}