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
6
bool
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
35
int
main
()
36
{
37
zip
();
38
return
0;
39
}
QByteArray
\inmodule QtCore
Definition
qbytearray.h:57
zip
bool zip()
Definition
process.cpp:6
main
int main()
Definition
process.cpp:35
QStringList
QList< QString > QStringList
Constructs a string list that contains the given string, str.
Definition
qcontainerfwd.h:40
qDebug
#define qDebug
[1]
Definition
qlogging.h:164
result
GLuint64EXT * result
[6]
Definition
qopenglext.h:10932
gzip
QProcess gzip
[0]
Definition
src_corelib_io_qiodevice.cpp:5
qtbase
src
corelib
doc
snippets
process
process.cpp
Generated by
1.10.0