Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
process.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
4#include <QProcess>
5
6bool zip()
7{
8//! [0]
9 QProcess gzip;
10 gzip.start("gzip", QStringList() << "-c");
11 if (!gzip.waitForStarted())
12 return false;
13
14 gzip.write("Qt rocks!");
15 gzip.closeWriteChannel();
16
17 if (!gzip.waitForFinished())
18 return false;
19
20 QByteArray result = gzip.readAll();
21//! [0]
22
23 gzip.start("gzip", QStringList() << "-d" << "-c");
24 gzip.write(result);
25 gzip.closeWriteChannel();
26
27 if (!gzip.waitForFinished())
28 return false;
29
30 qDebug("Result: %s", gzip.readAll().data());
31 return true;
32}
33
34
35int main()
36{
37 zip();
38 return 0;
39}
int main()
[open]
bool zip()
Definition process.cpp:6