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
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{
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();
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}
\inmodule QtCore
Definition qbytearray.h:57
bool zip()
Definition process.cpp:6
int main()
Definition process.cpp:35
QList< QString > QStringList
Constructs a string list that contains the given string, str.
#define qDebug
[1]
Definition qlogging.h:164
GLuint64EXT * result
[6]
QProcess gzip
[0]