Qt_IM_42 - 8BitsCoding/RobotMentor GitHub Wiki
์๋์ฐ์์๋ ์คํ์๋จ
#include <QtCore/QCoreApplication>
#include <qdebug.h>
#include <qdir.h>
#include <qprocess.h>
bool test() {
QProcess gzip;
gzip.start("gzip", QStringList() << "-c");
// gzip์ด๋ผ๋ process๋ฅผ ์คํํ๋๋ฐ -c์ด๋ผ๋ ์ต์
์ ๋ฃ๋๋ค.
if (!gzip.waitForStarted()) return false;
gzip.write("Qt rock!");
gzip.closeWriteChannel();
if (!gzip.waitForFinished()) return false;
QByteArray result = gzip.readAll();
qInfo() << "Result: " << result;
return true;
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
if (test()) {
qInfo() << "Compressed with gzip!";
}
else {
qInfo() << "failed to use gzip";
}
return a.exec();
}