summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {