summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2013-10-26 09:37:51 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-28 10:25:51 +0100
commit3b8a9efac07790cfbcabbf240c38ec16d85097fb (patch)
treeac69efe0ec673eb110f14890e4fef450055b244b /examples
parentccdf42d9d10a32ccdd4a12c643130ffdea498552 (diff)
downloadqtserialport-3b8a9efac07790cfbcabbf240c38ec16d85097fb.tar.gz
Close the standard input right after reading to avoid duplicate calls
Change-Id: Idd4b5bf996d57f0cd22a30496af3841f7d5a806a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/serialport/cwritersync/main.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/examples/serialport/cwritersync/main.cpp b/examples/serialport/cwritersync/main.cpp
index 756bbff..6433c7c 100644
--- a/examples/serialport/cwritersync/main.cpp
+++ b/examples/serialport/cwritersync/main.cpp
@@ -103,15 +103,13 @@ int main(int argc, char *argv[])
}
QByteArray writeData(dataFile.readAll());
+ dataFile.close();
if (writeData.isEmpty()) {
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;
- dataFile.close();
return 1;
}
- dataFile.close();
-
qint64 bytesWritten = serialPort.write(writeData);
if (bytesWritten == -1) {