Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 580

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qprocess.cpp -->
  <title>QProcess Class | Qt Core 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QProcess</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#macros">Macros</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#running-a-process">Running a Process</a></li>
<li class="level2"><a href="#communicating-via-channels">Communicating via Channels</a></li>
<li class="level2"><a href="#synchronous-process-api">Synchronous Process API</a></li>
<li class="level2"><a href="#notes-for-windows-users">Notes for Windows Users</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QProcess Class</h1>
<!-- $$$QProcess-brief -->
<p>The <a href="qprocess.html">QProcess</a> class is used to start external programs and to communicate with them. <a href="#details">More...</a></p>
<!-- @@@QProcess -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QProcess&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qiodevice.html">QIODevice</a></td></tr></table></div><ul>
<li><a href="qprocess-members.html">List of all members, including inherited members</a></li>
<li><a href="qprocess-obsolete.html">Obsolete members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are reentrant.</p>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qprocess-createprocessarguments.html">CreateProcessArguments</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#CreateProcessArgumentModifier-typedef">CreateProcessArgumentModifier</a></b></td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#ExitStatus-enum">ExitStatus</a></b> { NormalExit, CrashExit }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#InputChannelMode-enum">InputChannelMode</a></b> { ManagedInputChannel, ForwardedInputChannel }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#ProcessChannel-enum">ProcessChannel</a></b> { StandardOutput, StandardError }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#ProcessChannelMode-enum">ProcessChannelMode</a></b> { SeparateChannels, MergedChannels, ForwardedChannels, ForwardedErrorChannel, ForwardedOutputChannel }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#ProcessError-enum">ProcessError</a></b> { FailedToStart, Crashed, Timedout, WriteError, ReadError, UnknownError }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#ProcessState-enum">ProcessState</a></b> { NotRunning, Starting, Running }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#QProcess">QProcess</a></b>(QObject *<i>parent</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#dtor.QProcess">~QProcess</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#arguments">arguments</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#closeReadChannel">closeReadChannel</a></b>(ProcessChannel <i>channel</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#closeWriteChannel">closeWriteChannel</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> CreateProcessArgumentModifier </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#createProcessArgumentsModifier">createProcessArgumentsModifier</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QProcess::ProcessError </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#error">error</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#exitCode">exitCode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QProcess::ExitStatus </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#exitStatus">exitStatus</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> InputChannelMode </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#inputChannelMode">inputChannelMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#nativeArguments">nativeArguments</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ProcessChannelMode </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#processChannelMode">processChannelMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QProcessEnvironment </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#processEnvironment">processEnvironment</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qint64 </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#processId">processId</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#program">program</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#readAllStandardError">readAllStandardError</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#readAllStandardOutput">readAllStandardOutput</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> ProcessChannel </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#readChannel">readChannel</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setArguments">setArguments</a></b>(const QStringList &amp;<i>arguments</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setCreateProcessArgumentsModifier">setCreateProcessArgumentsModifier</a></b>(CreateProcessArgumentModifier <i>modifier</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setInputChannelMode">setInputChannelMode</a></b>(InputChannelMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setNativeArguments">setNativeArguments</a></b>(const QString &amp;<i>arguments</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setProcessChannelMode">setProcessChannelMode</a></b>(ProcessChannelMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setProcessEnvironment">setProcessEnvironment</a></b>(const QProcessEnvironment &amp;<i>environment</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setProgram">setProgram</a></b>(const QString &amp;<i>program</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setReadChannel">setReadChannel</a></b>(ProcessChannel <i>channel</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setStandardErrorFile">setStandardErrorFile</a></b>(const QString &amp;<i>fileName</i>, OpenMode <i>mode</i> = Truncate)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setStandardInputFile">setStandardInputFile</a></b>(const QString &amp;<i>fileName</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setStandardOutputFile">setStandardOutputFile</a></b>(const QString &amp;<i>fileName</i>, OpenMode <i>mode</i> = Truncate)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setStandardOutputProcess">setStandardOutputProcess</a></b>(QProcess *<i>destination</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setWorkingDirectory">setWorkingDirectory</a></b>(const QString &amp;<i>dir</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#start">start</a></b>(const QString &amp;<i>program</i>, const QStringList &amp;<i>arguments</i>, OpenMode <i>mode</i> = ReadWrite)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#start-1">start</a></b>(const QString &amp;<i>command</i>, OpenMode <i>mode</i> = ReadWrite)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#start-2">start</a></b>(OpenMode <i>mode</i> = ReadWrite)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QProcess::ProcessState </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#state">state</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#waitForFinished">waitForFinished</a></b>(int <i>msecs</i> = 30000)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#waitForStarted">waitForStarted</a></b>(int <i>msecs</i> = 30000)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#workingDirectory">workingDirectory</a></b>() const</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#atEnd">atEnd</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#bytesAvailable">bytesAvailable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#bytesToWrite">bytesToWrite</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#canReadLine">canReadLine</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#close">close</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#isSequential">isSequential</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#open">open</a></b>(OpenMode <i>mode</i> = ReadWrite)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#waitForBytesWritten">waitForBytesWritten</a></b>(int <i>msecs</i> = 30000)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#waitForReadyRead">waitForReadyRead</a></b>(int <i>msecs</i> = 30000)</td></tr>
</table></div>
<ul>
<li class="fn">43 public functions inherited from <a href="qiodevice.html#public-functions">QIODevice</a></li>
<li class="fn">32 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#kill">kill</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#terminate">terminate</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#errorOccurred">errorOccurred</a></b>(QProcess::ProcessError <i>error</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#finished">finished</a></b>(int <i>exitCode</i>, QProcess::ExitStatus <i>exitStatus</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#readyReadStandardError">readyReadStandardError</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#readyReadStandardOutput">readyReadStandardOutput</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#started">started</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#stateChanged">stateChanged</a></b>(QProcess::ProcessState <i>newState</i>)</td></tr>
</table></div>
<ul>
<li class="fn">6 signals inherited from <a href="qiodevice.html#signals">QIODevice</a></li>
<li class="fn">2 signals inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#execute">execute</a></b>(const QString &amp;<i>program</i>, const QStringList &amp;<i>arguments</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#execute-1">execute</a></b>(const QString &amp;<i>command</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#nullDevice">nullDevice</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#startDetached">startDetached</a></b>(const QString &amp;<i>program</i>, const QStringList &amp;<i>arguments</i>, const QString &amp;<i>workingDirectory</i> = QString(), qint64 *<i>pid</i> = Q_NULLPTR)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#startDetached-1">startDetached</a></b>(const QString &amp;<i>command</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#systemEnvironment">systemEnvironment</a></b>()</td></tr>
</table></div>
<ul>
<li class="fn">11 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2 id="protected-functions">Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setProcessState">setProcessState</a></b>(ProcessState <i>state</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#setupChildProcess">setupChildProcess</a></b>()</td></tr>
</table></div>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#readData">readData</a></b>(char *<i>data</i>, qint64 <i>maxlen</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual qint64 </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#writeData">writeData</a></b>(const char *<i>data</i>, qint64 <i>len</i>)</td></tr>
</table></div>
<ul>
<li class="fn">5 protected functions inherited from <a href="qiodevice.html#protected-functions">QIODevice</a></li>
<li class="fn">9 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="related-non-members"></a>
<h2 id="related-non-members">Related Non-Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#Q_PID-typedef">Q_PID</a></b></td></tr>
</table></div>
<a name="macros"></a>
<h2 id="macros">Macros</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qprocess.html#QT_NO_PROCESS_COMBINED_ARGUMENT_START">QT_NO_PROCESS_COMBINED_ARGUMENT_START</a></b></td></tr>
</table></div>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QProcess-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qprocess.html">QProcess</a> class is used to start external programs and to communicate with them.</p>
<a name="running-a-process"></a>
<h3 >Running a Process</h3>
<p>To start a process, pass the name and command line arguments of the program you want to run as arguments to <a href="qprocess.html#start">start</a>(). Arguments are supplied as individual strings in a <a href="qstringlist.html">QStringList</a>.</p>
<p>Alternatively, you can set the program to run with <a href="qprocess.html#setProgram">setProgram</a>() and <a href="qprocess.html#setArguments">setArguments</a>(), and then call <a href="qprocess.html#start">start</a>() or <a href="qprocess.html#open">open</a>().</p>
<p>For example, the following code snippet runs the analog clock example in the Fusion style on X11 platforms by passing strings containing &quot;-style&quot; and &quot;fusion&quot; as two items in the list of arguments:</p>
<pre class="cpp">

      <span class="type"><a href="qobject.html#QObject">QObject</a></span> <span class="operator">*</span>parent;
      ...
      <span class="type"><a href="qstring.html">QString</a></span> program <span class="operator">=</span> <span class="string">&quot;./path/to/Qt/examples/widgets/analogclock&quot;</span>;
      <span class="type"><a href="qstringlist.html">QStringList</a></span> arguments;
      arguments <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;-style&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;fusion&quot;</span>;

      <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> <span class="operator">*</span>myProcess <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span>(parent);
      myProcess<span class="operator">-</span><span class="operator">&gt;</span>start(program<span class="operator">,</span> arguments);

</pre>
<p><a href="qprocess.html">QProcess</a> then enters the <a href="qprocess.html#ProcessState-enum">Starting</a> state, and when the program has started, <a href="qprocess.html">QProcess</a> enters the <a href="qprocess.html#ProcessState-enum">Running</a> state and emits <a href="qprocess.html#started">started</a>().</p>
<p><a href="qprocess.html">QProcess</a> allows you to treat a process as a sequential I/O device. You can write to and read from the process just as you would access a network connection using <a href="../qtnetwork/qtcpsocket.html">QTcpSocket</a>. You can then write to the process's standard input by calling <a href="qiodevice.html#write">write</a>(), and read the standard output by calling <a href="qiodevice.html#read">read</a>(), <a href="qiodevice.html#readLine">readLine</a>(), and <a href="qiodevice.html#getChar">getChar</a>(). Because it inherits <a href="qiodevice.html">QIODevice</a>, <a href="qprocess.html">QProcess</a> can also be used as an input source for <a href="../qtxml/qxmlreader.html">QXmlReader</a>, or for generating data to be uploaded using <a href="../qtnetwork/qnetworkaccessmanager.html">QNetworkAccessManager</a>.</p>
<p>When the process exits, <a href="qprocess.html">QProcess</a> reenters the <a href="qprocess.html#ProcessState-enum">NotRunning</a> state (the initial state), and emits <a href="qprocess.html#finished">finished</a>().</p>
<p>The <a href="qprocess.html#finished">finished</a>() signal provides the exit code and exit status of the process as arguments, and you can also call <a href="qprocess.html#exitCode">exitCode</a>() to obtain the exit code of the last process that finished, and <a href="qprocess.html#exitStatus">exitStatus</a>() to obtain its exit status. If an error occurs at any point in time, <a href="qprocess.html">QProcess</a> will emit the <a href="qprocess.html#errorOccurred">errorOccurred</a>() signal. You can also call <a href="qprocess.html#error">error</a>() to find the type of error that occurred last, and <a href="qprocess.html#state">state</a>() to find the current process state.</p>
<p><b>Note: </b><a href="qprocess.html">QProcess</a> is not supported on VxWorks, iOS, tvOS, watchOS, or the Universal Windows Platform.</p><a name="communicating-via-channels"></a>
<h3 >Communicating via Channels</h3>
<p>Processes have two predefined output channels: The standard output channel (<code>stdout</code>) supplies regular console output, and the standard error channel (<code>stderr</code>) usually supplies the errors that are printed by the process. These channels represent two separate streams of data. You can toggle between them by calling <a href="qprocess.html#setReadChannel">setReadChannel</a>(). <a href="qprocess.html">QProcess</a> emits <a href="qiodevice.html#readyRead">readyRead</a>() when data is available on the current read channel. It also emits <a href="qprocess.html#readyReadStandardOutput">readyReadStandardOutput</a>() when new standard output data is available, and when new standard error data is available, <a href="qprocess.html#readyReadStandardError">readyReadStandardError</a>() is emitted. Instead of calling <a href="qiodevice.html#read">read</a>(), <a href="qiodevice.html#readLine">readLine</a>(), or <a href="qiodevice.html#getChar">getChar</a>(), you can explicitly read all data from either of the two channels by calling <a href="qprocess.html#readAllStandardOutput">readAllStandardOutput</a>() or <a href="qprocess.html#readAllStandardError">readAllStandardError</a>().</p>
<p>The terminology for the channels can be misleading. Be aware that the process's output channels correspond to <a href="qprocess.html">QProcess</a>'s <i>read</i> channels, whereas the process's input channels correspond to <a href="qprocess.html">QProcess</a>'s <i>write</i> channels. This is because what we read using <a href="qprocess.html">QProcess</a> is the process's output, and what we write becomes the process's input.</p>
<p><a href="qprocess.html">QProcess</a> can merge the two output channels, so that standard output and standard error data from the running process both use the standard output channel. Call <a href="qprocess.html#setProcessChannelMode">setProcessChannelMode</a>() with <a href="qprocess.html#ProcessChannelMode-enum">MergedChannels</a> before starting the process to activate this feature. You also have the option of forwarding the output of the running process to the calling, main process, by passing <a href="qprocess.html#ProcessChannelMode-enum">ForwardedChannels</a> as the argument. It is also possible to forward only one of the output channels - typically one would use <a href="qprocess.html#ProcessChannelMode-enum">ForwardedErrorChannel</a>, but <a href="qprocess.html#ProcessChannelMode-enum">ForwardedOutputChannel</a> also exists. Note that using channel forwarding is typically a bad idea in GUI applications - you should present errors graphically instead.</p>
<p>Certain processes need special environment settings in order to operate. You can set environment variables for your process by calling <a href="qprocess.html#setProcessEnvironment">setProcessEnvironment</a>(). To set a working directory, call <a href="qprocess.html#setWorkingDirectory">setWorkingDirectory</a>(). By default, processes are run in the current working directory of the calling process.</p>
<p>The positioning and the screen Z-order of windows belonging to GUI applications started with <a href="qprocess.html">QProcess</a> are controlled by the underlying windowing system. For Qt 5 applications, the positioning can be specified using the <code>-qwindowgeometry</code> command line option; X11 applications generally accept a <code>-geometry</code> command line option.</p>
<p><b>Note: </b>On QNX, setting the working directory may cause all application threads, with the exception of the <a href="qprocess.html">QProcess</a> caller thread, to temporarily freeze during the spawning process, owing to a limitation in the operating system.</p><a name="synchronous-process-api"></a>
<h3 >Synchronous Process API</h3>
<p><a href="qprocess.html">QProcess</a> provides a set of functions which allow it to be used without an event loop, by suspending the calling thread until certain signals are emitted:</p>
<ul>
<li><a href="qprocess.html#waitForStarted">waitForStarted</a>() blocks until the process has started.</li>
<li><a href="qprocess.html#waitForReadyRead">waitForReadyRead</a>() blocks until new data is available for reading on the current read channel.</li>
<li><a href="qprocess.html#waitForBytesWritten">waitForBytesWritten</a>() blocks until one payload of data has been written to the process.</li>
<li><a href="qprocess.html#waitForFinished">waitForFinished</a>() blocks until the process has finished.</li>
</ul>
<p>Calling these functions from the main thread (the thread that calls <a href="../qtwidgets/qapplication.html#exec">QApplication::exec</a>()) may cause your user interface to freeze.</p>
<p>The following example runs <code>gzip</code> to compress the string &quot;Qt rocks!&quot;, without an event loop:</p>
<pre class="cpp">

      <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> gzip;
      gzip<span class="operator">.</span>start(<span class="string">&quot;gzip&quot;</span><span class="operator">,</span> <span class="type"><a href="qstringlist.html">QStringList</a></span>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;-c&quot;</span>);
      <span class="keyword">if</span> (<span class="operator">!</span>gzip<span class="operator">.</span>waitForStarted())
          <span class="keyword">return</span> <span class="keyword">false</span>;

      gzip<span class="operator">.</span>write(<span class="string">&quot;Qt rocks!&quot;</span>);
      gzip<span class="operator">.</span>closeWriteChannel();

      <span class="keyword">if</span> (<span class="operator">!</span>gzip<span class="operator">.</span>waitForFinished())
          <span class="keyword">return</span> <span class="keyword">false</span>;

      <span class="type"><a href="qbytearray.html">QByteArray</a></span> result <span class="operator">=</span> gzip<span class="operator">.</span>readAll();

</pre>
<a name="notes-for-windows-users"></a>
<h3 >Notes for Windows Users</h3>
<p>Some Windows commands (for example, <code>dir</code>) are not provided by separate applications, but by the command interpreter itself. If you attempt to use <a href="qprocess.html">QProcess</a> to execute these commands directly, it won't work. One possible solution is to execute the command interpreter itself (<code>cmd.exe</code> on some Windows systems), and ask the interpreter to execute the desired command.</p>
</div>
<p><b>See also </b><a href="qbuffer.html">QBuffer</a>, <a href="qfile.html">QFile</a>, and <a href="../qtnetwork/qtcpsocket.html">QTcpSocket</a>.</p>
<!-- @@@QProcess -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$CreateProcessArgumentModifier -->
<h3 class="fn" id="CreateProcessArgumentModifier-typedef"><a name="CreateProcessArgumentModifier-typedef"></a>typedef QProcess::<span class="name">CreateProcessArgumentModifier</span></h3>
<p><b>Note: </b>This typedef is only available on desktop Windows.</p><p>On Windows, <a href="qprocess.html">QProcess</a> uses the Win32 API function <code>CreateProcess</code> to start child processes. While <a href="qprocess.html">QProcess</a> provides a comfortable way to start processes without worrying about platform details, it is in some cases desirable to fine-tune the parameters that are passed to <code>CreateProcess</code>. This is done by defining a <code>CreateProcessArgumentModifier</code> function and passing it to <code>setCreateProcessArgumentsModifier</code>.</p>
<p>A <code>CreateProcessArgumentModifier</code> function takes one parameter: a pointer to a <code>CreateProcessArguments</code> struct. The members of this struct will be passed to <code>CreateProcess</code> after the <code>CreateProcessArgumentModifier</code> function is called.</p>
<p>The following example demonstrates how to pass custom flags to <code>CreateProcess</code>. When starting a console process B from a console process A, <a href="qprocess.html">QProcess</a> will reuse the console window of process A for process B by default. In this example, a new console window with a custom color scheme is created for the child process B instead.</p>
<pre class="cpp">

      <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> process;
      process<span class="operator">.</span>setCreateProcessArgumentsModifier(<span class="operator">[</span><span class="operator">]</span> (<span class="type"><a href="qprocess.html#QProcess">QProcess</a></span><span class="operator">::</span>CreateProcessArguments <span class="operator">*</span>args)
      {
          args<span class="operator">-</span><span class="operator">&gt;</span>flags <span class="operator">|</span><span class="operator">=</span> CREATE_NEW_CONSOLE;
          args<span class="operator">-</span><span class="operator">&gt;</span>startupInfo<span class="operator">-</span><span class="operator">&gt;</span>dwFlags <span class="operator">&amp;</span><span class="operator">=</span> <span class="operator">~</span>STARTF_USESTDHANDLES;
          args<span class="operator">-</span><span class="operator">&gt;</span>startupInfo<span class="operator">-</span><span class="operator">&gt;</span>dwFlags <span class="operator">|</span><span class="operator">=</span> STARTF_USEFILLATTRIBUTE;
          args<span class="operator">-</span><span class="operator">&gt;</span>startupInfo<span class="operator">-</span><span class="operator">&gt;</span>dwFillAttribute <span class="operator">=</span> BACKGROUND_BLUE <span class="operator">|</span> FOREGROUND_RED
                                             <span class="operator">|</span> FOREGROUND_INTENSITY;
      });
      process<span class="operator">.</span>start(<span class="string">&quot;C:\\Windows\\System32\\cmd.exe&quot;</span><span class="operator">,</span> <span class="type"><a href="qstringlist.html">QStringList</a></span>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;/k&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;title&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;The Child Process&quot;</span>);

</pre>
<p><b>See also </b><a href="qprocess-createprocessarguments.html">QProcess::CreateProcessArguments</a> and <a href="qprocess.html#setCreateProcessArgumentsModifier">setCreateProcessArgumentsModifier</a>().</p>
<!-- @@@CreateProcessArgumentModifier -->
<!-- $$$ExitStatus$$$NormalExit$$$CrashExit -->
<h3 class="fn" id="ExitStatus-enum"><a name="ExitStatus-enum"></a>enum QProcess::<span class="name">ExitStatus</span></h3>
<p>This enum describes the different exit statuses of <a href="qprocess.html">QProcess</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QProcess::NormalExit</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The process exited normally.</td></tr>
<tr><td class="topAlign"><code>QProcess::CrashExit</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The process crashed.</td></tr>
</table></div>
<p><b>See also </b><a href="qprocess.html#exitStatus">exitStatus</a>().</p>
<!-- @@@ExitStatus -->
<!-- $$$InputChannelMode$$$ManagedInputChannel$$$ForwardedInputChannel -->
<h3 class="fn" id="InputChannelMode-enum"><a name="InputChannelMode-enum"></a>enum QProcess::<span class="name">InputChannelMode</span></h3>
<p>This enum describes the process input channel modes of <a href="qprocess.html">QProcess</a>. Pass one of these values to <a href="qprocess.html#setInputChannelMode">setInputChannelMode</a>() to set the current write channel mode.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QProcess::ManagedInputChannel</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign"><a href="qprocess.html">QProcess</a> manages the input of the running process. This is the default input channel mode of <a href="qprocess.html">QProcess</a>.</td></tr>
<tr><td class="topAlign"><code>QProcess::ForwardedInputChannel</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign"><a href="qprocess.html">QProcess</a> forwards the input of the main process onto the running process. The child process reads its standard input from the same source as the main process. Note that the main process must not try to read its standard input while the child process is running.</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 5.2.</p>
<p><b>See also </b><a href="qprocess.html#setInputChannelMode">setInputChannelMode</a>().</p>
<!-- @@@InputChannelMode -->
<!-- $$$ProcessChannel$$$StandardOutput$$$StandardError -->
<h3 class="fn" id="ProcessChannel-enum"><a name="ProcessChannel-enum"></a>enum QProcess::<span class="name">ProcessChannel</span></h3>
<p>This enum describes the process channels used by the running process. Pass one of these values to <a href="qprocess.html#setReadChannel">setReadChannel</a>() to set the current read channel of <a href="qprocess.html">QProcess</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QProcess::StandardOutput</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The standard output (stdout) of the running process.</td></tr>
<tr><td class="topAlign"><code>QProcess::StandardError</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The standard error (stderr) of the running process.</td></tr>
</table></div>
<p><b>See also </b><a href="qprocess.html#setReadChannel">setReadChannel</a>().</p>
<!-- @@@ProcessChannel -->
<!-- $$$ProcessChannelMode$$$SeparateChannels$$$MergedChannels$$$ForwardedChannels$$$ForwardedOutputChannel$$$ForwardedErrorChannel -->
<h3 class="fn" id="ProcessChannelMode-enum"><a name="ProcessChannelMode-enum"></a>enum QProcess::<span class="name">ProcessChannelMode</span></h3>
<p>This enum describes the process output channel modes of <a href="qprocess.html">QProcess</a>. Pass one of these values to <a href="qprocess.html#setProcessChannelMode">setProcessChannelMode</a>() to set the current read channel mode.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QProcess::SeparateChannels</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign"><a href="qprocess.html">QProcess</a> manages the output of the running process, keeping standard output and standard error data in separate internal buffers. You can select the <a href="qprocess.html">QProcess</a>'s current read channel by calling <a href="qprocess.html#setReadChannel">setReadChannel</a>(). This is the default channel mode of <a href="qprocess.html">QProcess</a>.</td></tr>
<tr><td class="topAlign"><code>QProcess::MergedChannels</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign"><a href="qprocess.html">QProcess</a> merges the output of the running process into the standard output channel (<code>stdout</code>). The standard error channel (<code>stderr</code>) will not receive any data. The standard output and standard error data of the running process are interleaved.</td></tr>
<tr><td class="topAlign"><code>QProcess::ForwardedChannels</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign"><a href="qprocess.html">QProcess</a> forwards the output of the running process onto the main process. Anything the child process writes to its standard output and standard error will be written to the standard output and standard error of the main process.</td></tr>
<tr><td class="topAlign"><code>QProcess::ForwardedErrorChannel</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign"><a href="qprocess.html">QProcess</a> manages the standard output of the running process, but forwards its standard error onto the main process. This reflects the typical use of command line tools as filters, where the standard output is redirected to another process or a file, while standard error is printed to the console for diagnostic purposes. (This value was introduced in Qt 5.2&#x2e;)</td></tr>
<tr><td class="topAlign"><code>QProcess::ForwardedOutputChannel</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">Complementary to ForwardedErrorChannel. (This value was introduced in Qt 5.2&#x2e;)</td></tr>
</table></div>
<p><b>Note: </b>Windows intentionally suppresses output from GUI-only applications to inherited consoles. This does <i>not</i> apply to output redirected to files or pipes. To forward the output of GUI-only applications on the console nonetheless, you must use SeparateChannels and do the forwarding yourself by reading the output and writing it to the appropriate output channels.</p><p><b>See also </b><a href="qprocess.html#setProcessChannelMode">setProcessChannelMode</a>().</p>
<!-- @@@ProcessChannelMode -->
<!-- $$$ProcessError$$$FailedToStart$$$Crashed$$$Timedout$$$ReadError$$$WriteError$$$UnknownError -->
<h3 class="fn" id="ProcessError-enum"><a name="ProcessError-enum"></a>enum QProcess::<span class="name">ProcessError</span></h3>
<p>This enum describes the different types of errors that are reported by <a href="qprocess.html">QProcess</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QProcess::FailedToStart</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.</td></tr>
<tr><td class="topAlign"><code>QProcess::Crashed</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The process crashed some time after starting successfully.</td></tr>
<tr><td class="topAlign"><code>QProcess::Timedout</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The last waitFor...() function timed out. The state of <a href="qprocess.html">QProcess</a> is unchanged, and you can try calling waitFor...() again.</td></tr>
<tr><td class="topAlign"><code>QProcess::WriteError</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.</td></tr>
<tr><td class="topAlign"><code>QProcess::ReadError</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">An error occurred when attempting to read from the process. For example, the process may not be running.</td></tr>
<tr><td class="topAlign"><code>QProcess::UnknownError</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">An unknown error occurred. This is the default return value of <a href="qprocess.html#error">error</a>().</td></tr>
</table></div>
<p><b>See also </b><a href="qprocess.html#error">error</a>().</p>
<!-- @@@ProcessError -->
<!-- $$$ProcessState$$$NotRunning$$$Starting$$$Running -->
<h3 class="fn" id="ProcessState-enum"><a name="ProcessState-enum"></a>enum QProcess::<span class="name">ProcessState</span></h3>
<p>This enum describes the different states of <a href="qprocess.html">QProcess</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QProcess::NotRunning</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The process is not running.</td></tr>
<tr><td class="topAlign"><code>QProcess::Starting</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The process is starting, but the program has not yet been invoked.</td></tr>
<tr><td class="topAlign"><code>QProcess::Running</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The process is running and is ready for reading and writing.</td></tr>
</table></div>
<p><b>See also </b><a href="qprocess.html#state">state</a>().</p>
<!-- @@@ProcessState -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QProcess[overload1]$$$QProcessQObject* -->
<h3 class="fn" id="QProcess"><a name="QProcess"></a>QProcess::<span class="name">QProcess</span>(<span class="type"><a href="qobject.html#QObject">QObject</a></span> *<i>parent</i> = Q_NULLPTR)</h3>
<p>Constructs a <a href="qprocess.html">QProcess</a> object with the given <i>parent</i>.</p>
<!-- @@@QProcess -->
<!-- $$$~QProcess[overload1]$$$~QProcess -->
<h3 class="fn" id="dtor.QProcess"><a name="dtor.QProcess"></a><code>[virtual] </code>QProcess::<span class="name">~QProcess</span>()</h3>
<p>Destructs the <a href="qprocess.html">QProcess</a> object, i.e&#x2e;, killing the process.</p>
<p>Note that this function will not return until the process is terminated.</p>
<!-- @@@~QProcess -->
<!-- $$$arguments[overload1]$$$arguments -->
<h3 class="fn" id="arguments"><a name="arguments"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QProcess::<span class="name">arguments</span>() const</h3>
<p>Returns the command line arguments the process was last started with.</p>
<p>This function was introduced in  Qt 5.0.</p>
<p><b>See also </b><a href="qprocess.html#setArguments">setArguments</a>() and <a href="qprocess.html#start">start</a>().</p>
<!-- @@@arguments -->
<!-- $$$atEnd[overload1]$$$atEnd -->
<h3 class="fn" id="atEnd"><a name="atEnd"></a><code>[virtual] </code><span class="type">bool</span> QProcess::<span class="name">atEnd</span>() const</h3>
<p>Reimplemented from <a href="qiodevice.html#atEnd">QIODevice::atEnd</a>().</p>
<p>Returns <code>true</code> if the process is not running, and no more data is available for reading; otherwise returns <code>false</code>.</p>
<!-- @@@atEnd -->
<!-- $$$bytesAvailable[overload1]$$$bytesAvailable -->
<h3 class="fn" id="bytesAvailable"><a name="bytesAvailable"></a><code>[virtual] </code><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QProcess::<span class="name">bytesAvailable</span>() const</h3>
<p>Reimplemented from <a href="qiodevice.html#bytesAvailable">QIODevice::bytesAvailable</a>().</p>
<!-- @@@bytesAvailable -->
<!-- $$$bytesToWrite[overload1]$$$bytesToWrite -->
<h3 class="fn" id="bytesToWrite"><a name="bytesToWrite"></a><code>[virtual] </code><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QProcess::<span class="name">bytesToWrite</span>() const</h3>
<p>Reimplemented from <a href="qiodevice.html#bytesToWrite">QIODevice::bytesToWrite</a>().</p>
<!-- @@@bytesToWrite -->
<!-- $$$canReadLine[overload1]$$$canReadLine -->
<h3 class="fn" id="canReadLine"><a name="canReadLine"></a><code>[virtual] </code><span class="type">bool</span> QProcess::<span class="name">canReadLine</span>() const</h3>
<p>Reimplemented from <a href="qiodevice.html#canReadLine">QIODevice::canReadLine</a>().</p>
<p>This function operates on the current read channel.</p>
<p><b>See also </b><a href="qprocess.html#readChannel">readChannel</a>() and <a href="qprocess.html#setReadChannel">setReadChannel</a>().</p>
<!-- @@@canReadLine -->
<!-- $$$close[overload1]$$$close -->
<h3 class="fn" id="close"><a name="close"></a><code>[virtual] </code><span class="type">void</span> QProcess::<span class="name">close</span>()</h3>
<p>Reimplemented from <a href="qiodevice.html#close">QIODevice::close</a>().</p>
<p>Closes all communication with the process and kills it. After calling this function, <a href="qprocess.html">QProcess</a> will no longer emit <a href="qiodevice.html#readyRead">readyRead</a>(), and data can no longer be read or written.</p>
<!-- @@@close -->
<!-- $$$closeReadChannel[overload1]$$$closeReadChannelProcessChannel -->
<h3 class="fn" id="closeReadChannel"><a name="closeReadChannel"></a><span class="type">void</span> QProcess::<span class="name">closeReadChannel</span>(<span class="type"><a href="qprocess.html#ProcessChannel-enum">ProcessChannel</a></span> <i>channel</i>)</h3>
<p>Closes the read channel <i>channel</i>. After calling this function, <a href="qprocess.html">QProcess</a> will no longer receive data on the channel. Any data that has already been received is still available for reading.</p>
<p>Call this function to save memory, if you are not interested in the output of the process.</p>
<p><b>See also </b><a href="qprocess.html#closeWriteChannel">closeWriteChannel</a>() and <a href="qprocess.html#setReadChannel">setReadChannel</a>().</p>
<!-- @@@closeReadChannel -->
<!-- $$$closeWriteChannel[overload1]$$$closeWriteChannel -->
<h3 class="fn" id="closeWriteChannel"><a name="closeWriteChannel"></a><span class="type">void</span> QProcess::<span class="name">closeWriteChannel</span>()</h3>
<p>Schedules the write channel of <a href="qprocess.html">QProcess</a> to be closed. The channel will close once all data has been written to the process. After calling this function, any attempts to write to the process will fail.</p>
<p>Closing the write channel is necessary for programs that read input data until the channel has been closed. For example, the program &quot;more&quot; is used to display text data in a console on both Unix and Windows. But it will not display the text data until <a href="qprocess.html">QProcess</a>'s write channel has been closed. Example:</p>
<pre class="cpp">

  <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> more;
  more<span class="operator">.</span>start(<span class="string">&quot;more&quot;</span>);
  more<span class="operator">.</span>write(<span class="string">&quot;Text to display&quot;</span>);
  more<span class="operator">.</span>closeWriteChannel();
  <span class="comment">// QProcess will emit readyRead() once &quot;more&quot; starts printing</span>

</pre>
<p>The write channel is implicitly opened when <a href="qprocess.html#start">start</a>() is called.</p>
<p><b>See also </b><a href="qprocess.html#closeReadChannel">closeReadChannel</a>().</p>
<!-- @@@closeWriteChannel -->
<!-- $$$createProcessArgumentsModifier[overload1]$$$createProcessArgumentsModifier -->
<h3 class="fn" id="createProcessArgumentsModifier"><a name="createProcessArgumentsModifier"></a><span class="type"><a href="qprocess.html#CreateProcessArgumentModifier-typedef">CreateProcessArgumentModifier</a></span> QProcess::<span class="name">createProcessArgumentsModifier</span>() const</h3>
<p>Returns a previously set <code>CreateProcess</code> modifier function.</p>
<p><b>Note: </b>This function is available only on the Windows platform.</p><p>This function was introduced in  Qt 5.7.</p>
<p><b>See also </b><a href="qprocess.html#setCreateProcessArgumentsModifier">setCreateProcessArgumentsModifier</a>() and <a href="qprocess.html#CreateProcessArgumentModifier-typedef">QProcess::CreateProcessArgumentModifier</a>.</p>
<!-- @@@createProcessArgumentsModifier -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn" id="error"><a name="error"></a><span class="type"><a href="qprocess.html#ProcessError-enum">QProcess::ProcessError</a></span> QProcess::<span class="name">error</span>() const</h3>
<p>Returns the type of error that occurred last.</p>
<p><b>See also </b><a href="qprocess.html#state">state</a>().</p>
<!-- @@@error -->
<!-- $$$errorOccurred[overload1]$$$errorOccurredQProcess::ProcessError -->
<h3 class="fn" id="errorOccurred"><a name="errorOccurred"></a><code>[signal] </code><span class="type">void</span> QProcess::<span class="name">errorOccurred</span>(<span class="type"><a href="qprocess.html#ProcessError-enum">QProcess::ProcessError</a></span> <i>error</i>)</h3>
<p>This signal is emitted when an error occurs with the process. The specified <i>error</i> describes the type of error that occurred.</p>
<p>This function was introduced in  Qt 5.6.</p>
<!-- @@@errorOccurred -->
<!-- $$$execute[overload1]$$$executeconstQString&constQStringList& -->
<h3 class="fn" id="execute"><a name="execute"></a><code>[static] </code><span class="type">int</span> QProcess::<span class="name">execute</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>program</i>, const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp;<i>arguments</i>)</h3>
<p>Starts the program <i>program</i> with the arguments <i>arguments</i> in a new process, waits for it to finish, and then returns the exit code of the process. Any data the new process writes to the console is forwarded to the calling process.</p>
<p>The environment and working directory are inherited from the calling process.</p>
<p>Argument handling is identical to the respective <a href="qprocess.html#start">start</a>() overload.</p>
<p>If the process cannot be started, -2 is returned. If the process crashes, -1 is returned. Otherwise, the process' exit code is returned.</p>
<p><b>See also </b><a href="qprocess.html#start">start</a>().</p>
<!-- @@@execute -->
<!-- $$$execute$$$executeconstQString& -->
<h3 class="fn" id="execute-1"><a name="execute-1"></a><code>[static] </code><span class="type">int</span> QProcess::<span class="name">execute</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>command</i>)</h3>
<p>This is an overloaded function.</p>
<p>Starts the program <i>command</i> in a new process, waits for it to finish, and then returns the exit code.</p>
<p>Argument handling is identical to the respective <a href="qprocess.html#start">start</a>() overload.</p>
<p>After the <i>command</i> string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list.</p>
<p><b>See also </b><a href="qprocess.html#start">start</a>().</p>
<!-- @@@execute -->
<!-- $$$exitCode[overload1]$$$exitCode -->
<h3 class="fn" id="exitCode"><a name="exitCode"></a><span class="type">int</span> QProcess::<span class="name">exitCode</span>() const</h3>
<p>Returns the exit code of the last process that finished.</p>
<p>This value is not valid unless <a href="qprocess.html#exitStatus">exitStatus</a>() returns <a href="qprocess.html#ExitStatus-enum">NormalExit</a>.</p>
<!-- @@@exitCode -->
<!-- $$$exitStatus[overload1]$$$exitStatus -->
<h3 class="fn" id="exitStatus"><a name="exitStatus"></a><span class="type"><a href="qprocess.html#ExitStatus-enum">QProcess::ExitStatus</a></span> QProcess::<span class="name">exitStatus</span>() const</h3>
<p>Returns the exit status of the last process that finished.</p>
<p>On Windows, if the process was terminated with TerminateProcess() from another application, this function will still return <a href="qprocess.html#ExitStatus-enum">NormalExit</a> unless the exit code is less than 0.</p>
<p>This function was introduced in  Qt 4.1.</p>
<!-- @@@exitStatus -->
<!-- $$$finished[overload1]$$$finishedintQProcess::ExitStatus -->
<h3 class="fn" id="finished"><a name="finished"></a><code>[signal] </code><span class="type">void</span> QProcess::<span class="name">finished</span>(<span class="type">int</span> <i>exitCode</i>, <span class="type"><a href="qprocess.html#ExitStatus-enum">QProcess::ExitStatus</a></span> <i>exitStatus</i>)</h3>
<p>This signal is emitted when the process finishes. <i>exitCode</i> is the exit code of the process (only valid for normal exits), and <i>exitStatus</i> is the exit status. After the process has finished, the buffers in <a href="qprocess.html">QProcess</a> are still intact. You can still read any data that the process may have written before it finished.</p>
<p><b>Note:</b> Signal <i>finished</i> is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:<pre class="cpp">

  connect(process<span class="operator">,</span> <span class="keyword">static_cast</span><span class="operator">&lt;</span><span class="type">void</span>(<span class="type"><a href="qprocess.html#QProcess">QProcess</a></span><span class="operator">::</span><span class="operator">*</span>)(<span class="type">int</span><span class="operator">,</span> <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span><span class="operator">::</span>ExitStatus)<span class="operator">&gt;</span>(<span class="operator">&amp;</span><span class="type"><a href="qprocess.html#QProcess">QProcess</a></span><span class="operator">::</span>finished)<span class="operator">,</span>
      <span class="operator">[</span><span class="operator">=</span><span class="operator">]</span>(<span class="type">int</span> exitCode<span class="operator">,</span> <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span><span class="operator">::</span>ExitStatus exitStatus){ <span class="comment">/* ... */</span> });

</pre>
<p><b>See also </b><a href="qprocess.html#exitStatus">exitStatus</a>().</p>
<!-- @@@finished -->
<!-- $$$inputChannelMode[overload1]$$$inputChannelMode -->
<h3 class="fn" id="inputChannelMode"><a name="inputChannelMode"></a><span class="type"><a href="qprocess.html#InputChannelMode-enum">InputChannelMode</a></span> QProcess::<span class="name">inputChannelMode</span>() const</h3>
<p>Returns the channel mode of the <a href="qprocess.html">QProcess</a> standard input channel.</p>
<p>This function was introduced in  Qt 5.2.</p>
<p><b>See also </b><a href="qprocess.html#setInputChannelMode">setInputChannelMode</a>() and <a href="qprocess.html#InputChannelMode-enum">InputChannelMode</a>.</p>
<!-- @@@inputChannelMode -->
<!-- $$$isSequential[overload1]$$$isSequential -->
<h3 class="fn" id="isSequential"><a name="isSequential"></a><code>[virtual] </code><span class="type">bool</span> QProcess::<span class="name">isSequential</span>() const</h3>
<p>Reimplemented from <a href="qiodevice.html#isSequential">QIODevice::isSequential</a>().</p>
<!-- @@@isSequential -->
<!-- $$$kill[overload1]$$$kill -->
<h3 class="fn" id="kill"><a name="kill"></a><code>[slot] </code><span class="type">void</span> QProcess::<span class="name">kill</span>()</h3>
<p>Kills the current process, causing it to exit immediately.</p>
<p>On Windows, kill() uses TerminateProcess, and on Unix and macOS, the SIGKILL signal is sent to the process.</p>
<p><b>See also </b><a href="qprocess.html#terminate">terminate</a>().</p>
<!-- @@@kill -->
<!-- $$$nativeArguments[overload1]$$$nativeArguments -->
<h3 class="fn" id="nativeArguments"><a name="nativeArguments"></a><span class="type"><a href="qstring.html">QString</a></span> QProcess::<span class="name">nativeArguments</span>() const</h3>
<p>Returns the additional native command line arguments for the program.</p>
<p><b>Note: </b>This function is available only on the Windows platform.</p><p>This function was introduced in  Qt 4.7.</p>
<p><b>See also </b><a href="qprocess.html#setNativeArguments">setNativeArguments</a>().</p>
<!-- @@@nativeArguments -->
<!-- $$$nullDevice[overload1]$$$nullDevice -->
<h3 class="fn" id="nullDevice"><a name="nullDevice"></a><code>[static] </code><span class="type"><a href="qstring.html">QString</a></span> QProcess::<span class="name">nullDevice</span>()</h3>
<p>The null device of the operating system.</p>
<p>The returned file path uses native directory separators.</p>
<p>This function was introduced in  Qt 5.2.</p>
<p><b>See also </b><a href="qprocess.html#setStandardInputFile">QProcess::setStandardInputFile</a>(), <a href="qprocess.html#setStandardOutputFile">QProcess::setStandardOutputFile</a>(), and <a href="qprocess.html#setStandardErrorFile">QProcess::setStandardErrorFile</a>().</p>
<!-- @@@nullDevice -->
<!-- $$$open[overload1]$$$openOpenMode -->
<h3 class="fn" id="open"><a name="open"></a><code>[virtual] </code><span class="type">bool</span> QProcess::<span class="name">open</span>(<span class="type"><a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a></span> <i>mode</i> = ReadWrite)</h3>
<p>Reimplemented from <a href="qiodevice.html#open">QIODevice::open</a>().</p>
<p>Starts the program set by <a href="qprocess.html#setProgram">setProgram</a>() with arguments set by <a href="qprocess.html#setArguments">setArguments</a>(). The <a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a> is set to <i>mode</i>.</p>
<p>This method is an alias for <a href="qprocess.html#start">start</a>(), and exists only to fully implement the interface defined by <a href="qiodevice.html">QIODevice</a>.</p>
<p><b>See also </b><a href="qprocess.html#start">start</a>(), <a href="qprocess.html#setProgram">setProgram</a>(), and <a href="qprocess.html#setArguments">setArguments</a>().</p>
<!-- @@@open -->
<!-- $$$processChannelMode[overload1]$$$processChannelMode -->
<h3 class="fn" id="processChannelMode"><a name="processChannelMode"></a><span class="type"><a href="qprocess.html#ProcessChannelMode-enum">ProcessChannelMode</a></span> QProcess::<span class="name">processChannelMode</span>() const</h3>
<p>Returns the channel mode of the <a href="qprocess.html">QProcess</a> standard output and standard error channels.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qprocess.html#setProcessChannelMode">setProcessChannelMode</a>(), <a href="qprocess.html#ProcessChannelMode-enum">ProcessChannelMode</a>, and <a href="qprocess.html#setReadChannel">setReadChannel</a>().</p>
<!-- @@@processChannelMode -->
<!-- $$$processEnvironment[overload1]$$$processEnvironment -->
<h3 class="fn" id="processEnvironment"><a name="processEnvironment"></a><span class="type"><a href="qprocessenvironment.html">QProcessEnvironment</a></span> QProcess::<span class="name">processEnvironment</span>() const</h3>
<p>Returns the environment that <a href="qprocess.html">QProcess</a> will pass to its child process, or an empty object if no environment has been set using setEnvironment() or <a href="qprocess.html#setProcessEnvironment">setProcessEnvironment</a>(). If no environment has been set, the environment of the calling process will be used.</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qprocess.html#setProcessEnvironment">setProcessEnvironment</a>(), <a href="qprocess-obsolete.html#setEnvironment">setEnvironment</a>(), and <a href="qprocessenvironment.html#isEmpty">QProcessEnvironment::isEmpty</a>().</p>
<!-- @@@processEnvironment -->
<!-- $$$processId[overload1]$$$processId -->
<h3 class="fn" id="processId"><a name="processId"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QProcess::<span class="name">processId</span>() const</h3>
<p>Returns the native process identifier for the running process, if available. If no process is currently running, <code>0</code> is returned.</p>
<p>This function was introduced in  Qt 5.3.</p>
<!-- @@@processId -->
<!-- $$$program[overload1]$$$program -->
<h3 class="fn" id="program"><a name="program"></a><span class="type"><a href="qstring.html">QString</a></span> QProcess::<span class="name">program</span>() const</h3>
<p>Returns the program the process was last started with.</p>
<p>This function was introduced in  Qt 5.0.</p>
<p><b>See also </b><a href="qprocess.html#setProgram">setProgram</a>() and <a href="qprocess.html#start">start</a>().</p>
<!-- @@@program -->
<!-- $$$readAllStandardError[overload1]$$$readAllStandardError -->
<h3 class="fn" id="readAllStandardError"><a name="readAllStandardError"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QProcess::<span class="name">readAllStandardError</span>()</h3>
<p>Regardless of the current read channel, this function returns all data available from the standard error of the process as a <a href="qbytearray.html">QByteArray</a>.</p>
<p><b>See also </b><a href="qprocess.html#readyReadStandardError">readyReadStandardError</a>(), <a href="qprocess.html#readAllStandardOutput">readAllStandardOutput</a>(), <a href="qprocess.html#readChannel">readChannel</a>(), and <a href="qprocess.html#setReadChannel">setReadChannel</a>().</p>
<!-- @@@readAllStandardError -->
<!-- $$$readAllStandardOutput[overload1]$$$readAllStandardOutput -->
<h3 class="fn" id="readAllStandardOutput"><a name="readAllStandardOutput"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QProcess::<span class="name">readAllStandardOutput</span>()</h3>
<p>Regardless of the current read channel, this function returns all data available from the standard output of the process as a <a href="qbytearray.html">QByteArray</a>.</p>
<p><b>See also </b><a href="qprocess.html#readyReadStandardOutput">readyReadStandardOutput</a>(), <a href="qprocess.html#readAllStandardError">readAllStandardError</a>(), <a href="qprocess.html#readChannel">readChannel</a>(), and <a href="qprocess.html#setReadChannel">setReadChannel</a>().</p>
<!-- @@@readAllStandardOutput -->
<!-- $$$readChannel[overload1]$$$readChannel -->
<h3 class="fn" id="readChannel"><a name="readChannel"></a><span class="type"><a href="qprocess.html#ProcessChannel-enum">ProcessChannel</a></span> QProcess::<span class="name">readChannel</span>() const</h3>
<p>Returns the current read channel of the <a href="qprocess.html">QProcess</a>.</p>
<p><b>See also </b><a href="qprocess.html#setReadChannel">setReadChannel</a>().</p>
<!-- @@@readChannel -->
<!-- $$$readData[overload1]$$$readDatachar*qint64 -->
<h3 class="fn" id="readData"><a name="readData"></a><code>[virtual protected] </code><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QProcess::<span class="name">readData</span>(<span class="type">char</span> *<i>data</i>, <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>maxlen</i>)</h3>
<p>Reimplemented from <a href="qiodevice.html#readData">QIODevice::readData</a>().</p>
<!-- @@@readData -->
<!-- $$$readyReadStandardError[overload1]$$$readyReadStandardError -->
<h3 class="fn" id="readyReadStandardError"><a name="readyReadStandardError"></a><code>[signal] </code><span class="type">void</span> QProcess::<span class="name">readyReadStandardError</span>()</h3>
<p>This signal is emitted when the process has made new data available through its standard error channel (<code>stderr</code>). It is emitted regardless of the current <a href="qprocess.html#readChannel">read channel</a>.</p>
<p><b>Note: </b>This is a private signal. It can be used in signal connections but cannot be emitted by the user.</p>
<p><b>See also </b><a href="qprocess.html#readAllStandardError">readAllStandardError</a>() and <a href="qprocess.html#readChannel">readChannel</a>().</p>
<!-- @@@readyReadStandardError -->
<!-- $$$readyReadStandardOutput[overload1]$$$readyReadStandardOutput -->
<h3 class="fn" id="readyReadStandardOutput"><a name="readyReadStandardOutput"></a><code>[signal] </code><span class="type">void</span> QProcess::<span class="name">readyReadStandardOutput</span>()</h3>
<p>This signal is emitted when the process has made new data available through its standard output channel (<code>stdout</code>). It is emitted regardless of the current <a href="qprocess.html#readChannel">read channel</a>.</p>
<p><b>Note: </b>This is a private signal. It can be used in signal connections but cannot be emitted by the user.</p>
<p><b>See also </b><a href="qprocess.html#readAllStandardOutput">readAllStandardOutput</a>() and <a href="qprocess.html#readChannel">readChannel</a>().</p>
<!-- @@@readyReadStandardOutput -->
<!-- $$$setArguments[overload1]$$$setArgumentsconstQStringList& -->
<h3 class="fn" id="setArguments"><a name="setArguments"></a><span class="type">void</span> QProcess::<span class="name">setArguments</span>(const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp;<i>arguments</i>)</h3>
<p>Set the <i>arguments</i> to pass to the called program when starting the process. This function must be called before <a href="qprocess.html#start">start</a>().</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qprocess.html#start">start</a>(), <a href="qprocess.html#setProgram">setProgram</a>(), and <a href="qprocess.html#arguments">arguments</a>().</p>
<!-- @@@setArguments -->
<!-- $$$setCreateProcessArgumentsModifier[overload1]$$$setCreateProcessArgumentsModifierCreateProcessArgumentModifier -->
<h3 class="fn" id="setCreateProcessArgumentsModifier"><a name="setCreateProcessArgumentsModifier"></a><span class="type">void</span> QProcess::<span class="name">setCreateProcessArgumentsModifier</span>(<span class="type"><a href="qprocess.html#CreateProcessArgumentModifier-typedef">CreateProcessArgumentModifier</a></span> <i>modifier</i>)</h3>
<p>Sets the <i>modifier</i> for the <code>CreateProcess</code> Win32 API call. Pass <code>QProcess::CreateProcessArgumentModifier()</code> to remove a previously set one.</p>
<p><b>Note: </b>This function is available only on the Windows platform and requires C++11.</p><p>This function was introduced in  Qt 5.7.</p>
<p><b>See also </b><a href="qprocess.html#createProcessArgumentsModifier">createProcessArgumentsModifier</a>() and <a href="qprocess.html#CreateProcessArgumentModifier-typedef">QProcess::CreateProcessArgumentModifier</a>.</p>
<!-- @@@setCreateProcessArgumentsModifier -->
<!-- $$$setInputChannelMode[overload1]$$$setInputChannelModeInputChannelMode -->
<h3 class="fn" id="setInputChannelMode"><a name="setInputChannelMode"></a><span class="type">void</span> QProcess::<span class="name">setInputChannelMode</span>(<span class="type"><a href="qprocess.html#InputChannelMode-enum">InputChannelMode</a></span> <i>mode</i>)</h3>
<p>Sets the channel mode of the <a href="qprocess.html">QProcess</a> standard input channel to the <i>mode</i> specified. This mode will be used the next time <a href="qprocess.html#start">start</a>() is called.</p>
<p>This function was introduced in  Qt 5.2.</p>
<p><b>See also </b><a href="qprocess.html#inputChannelMode">inputChannelMode</a>() and <a href="qprocess.html#InputChannelMode-enum">InputChannelMode</a>.</p>
<!-- @@@setInputChannelMode -->
<!-- $$$setNativeArguments[overload1]$$$setNativeArgumentsconstQString& -->
<h3 class="fn" id="setNativeArguments"><a name="setNativeArguments"></a><span class="type">void</span> QProcess::<span class="name">setNativeArguments</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>arguments</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets additional native command line <i>arguments</i> for the program.</p>
<p>On operating systems where the system API for passing command line <i>arguments</i> to a subprocess natively uses a single string, one can conceive command lines which cannot be passed via <a href="qprocess.html">QProcess</a>'s portable list-based API. In such cases this function must be used to set a string which is <i>appended</i> to the string composed from the usual argument list, with a delimiting space.</p>
<p><b>Note: </b>This function is available only on the Windows platform.</p><p>This function was introduced in  Qt 4.7.</p>
<p><b>See also </b><a href="qprocess.html#nativeArguments">nativeArguments</a>().</p>
<!-- @@@setNativeArguments -->
<!-- $$$setProcessChannelMode[overload1]$$$setProcessChannelModeProcessChannelMode -->
<h3 class="fn" id="setProcessChannelMode"><a name="setProcessChannelMode"></a><span class="type">void</span> QProcess::<span class="name">setProcessChannelMode</span>(<span class="type"><a href="qprocess.html#ProcessChannelMode-enum">ProcessChannelMode</a></span> <i>mode</i>)</h3>
<p>Sets the channel mode of the <a href="qprocess.html">QProcess</a> standard output and standard error channels to the <i>mode</i> specified. This mode will be used the next time <a href="qprocess.html#start">start</a>() is called. For example:</p>
<pre class="cpp">

  <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> builder;
  builder<span class="operator">.</span>setProcessChannelMode(<span class="type"><a href="qprocess.html#QProcess">QProcess</a></span><span class="operator">::</span>MergedChannels);
  builder<span class="operator">.</span>start(<span class="string">&quot;make&quot;</span><span class="operator">,</span> <span class="type"><a href="qstringlist.html">QStringList</a></span>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;-j2&quot;</span>);

  <span class="keyword">if</span> (<span class="operator">!</span>builder<span class="operator">.</span>waitForFinished())
      <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Make failed:&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> builder<span class="operator">.</span>errorString();
  <span class="keyword">else</span>
      <a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Make output:&quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> builder<span class="operator">.</span>readAll();

</pre>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qprocess.html#processChannelMode">processChannelMode</a>(), <a href="qprocess.html#ProcessChannelMode-enum">ProcessChannelMode</a>, and <a href="qprocess.html#setReadChannel">setReadChannel</a>().</p>
<!-- @@@setProcessChannelMode -->
<!-- $$$setProcessEnvironment[overload1]$$$setProcessEnvironmentconstQProcessEnvironment& -->
<h3 class="fn" id="setProcessEnvironment"><a name="setProcessEnvironment"></a><span class="type">void</span> QProcess::<span class="name">setProcessEnvironment</span>(const <span class="type"><a href="qprocessenvironment.html">QProcessEnvironment</a></span> &amp;<i>environment</i>)</h3>
<p>Sets the <i>environment</i> that <a href="qprocess.html">QProcess</a> will pass to the child process.</p>
<p>For example, the following code adds the environment variable <code>TMPDIR</code>:</p>
<pre class="cpp">

  <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> process;
  <span class="type"><a href="qprocessenvironment.html">QProcessEnvironment</a></span> env <span class="operator">=</span> <span class="type"><a href="qprocessenvironment.html">QProcessEnvironment</a></span><span class="operator">::</span>systemEnvironment();
  env<span class="operator">.</span>insert(<span class="string">&quot;TMPDIR&quot;</span><span class="operator">,</span> <span class="string">&quot;C:\\MyApp\\temp&quot;</span>); <span class="comment">// Add an environment variable</span>
  process<span class="operator">.</span>setProcessEnvironment(env);
  process<span class="operator">.</span>start(<span class="string">&quot;myapp&quot;</span>);

</pre>
<p>Note how, on Windows, environment variable names are case-insensitive.</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qprocess.html#processEnvironment">processEnvironment</a>(), <a href="qprocessenvironment.html#systemEnvironment">QProcessEnvironment::systemEnvironment</a>(), and <a href="qprocess-obsolete.html#setEnvironment">setEnvironment</a>().</p>
<!-- @@@setProcessEnvironment -->
<!-- $$$setProcessState[overload1]$$$setProcessStateProcessState -->
<h3 class="fn" id="setProcessState"><a name="setProcessState"></a><code>[protected] </code><span class="type">void</span> QProcess::<span class="name">setProcessState</span>(<span class="type"><a href="qprocess.html#ProcessState-enum">ProcessState</a></span> <i>state</i>)</h3>
<p>Sets the current state of the <a href="qprocess.html">QProcess</a> to the <i>state</i> specified.</p>
<p><b>See also </b><a href="qprocess.html#state">state</a>().</p>
<!-- @@@setProcessState -->
<!-- $$$setProgram[overload1]$$$setProgramconstQString& -->
<h3 class="fn" id="setProgram"><a name="setProgram"></a><span class="type">void</span> QProcess::<span class="name">setProgram</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>program</i>)</h3>
<p>Set the <i>program</i> to use when starting the process. This function must be called before <a href="qprocess.html#start">start</a>().</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qprocess.html#start">start</a>(), <a href="qprocess.html#setArguments">setArguments</a>(), and <a href="qprocess.html#program">program</a>().</p>
<!-- @@@setProgram -->
<!-- $$$setReadChannel[overload1]$$$setReadChannelProcessChannel -->
<h3 class="fn" id="setReadChannel"><a name="setReadChannel"></a><span class="type">void</span> QProcess::<span class="name">setReadChannel</span>(<span class="type"><a href="qprocess.html#ProcessChannel-enum">ProcessChannel</a></span> <i>channel</i>)</h3>
<p>Sets the current read channel of the <a href="qprocess.html">QProcess</a> to the given <i>channel</i>. The current input channel is used by the functions <a href="qiodevice.html#read">read</a>(), <a href="qiodevice.html#readAll">readAll</a>(), <a href="qiodevice.html#readLine">readLine</a>(), and <a href="qiodevice.html#getChar">getChar</a>(). It also determines which channel triggers <a href="qprocess.html">QProcess</a> to emit <a href="qiodevice.html#readyRead">readyRead</a>().</p>
<p><b>See also </b><a href="qprocess.html#readChannel">readChannel</a>().</p>
<!-- @@@setReadChannel -->
<!-- $$$setStandardErrorFile[overload1]$$$setStandardErrorFileconstQString&OpenMode -->
<h3 class="fn" id="setStandardErrorFile"><a name="setStandardErrorFile"></a><span class="type">void</span> QProcess::<span class="name">setStandardErrorFile</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>fileName</i>, <span class="type"><a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a></span> <i>mode</i> = Truncate)</h3>
<p>Redirects the process' standard error to the file <i>fileName</i>. When the redirection is in place, the standard error read channel is closed: reading from it using <a href="qiodevice.html#read">read</a>() will always fail, as will <a href="qprocess.html#readAllStandardError">readAllStandardError</a>(). The file will be appended to if <i>mode</i> is Append, otherwise, it will be truncated.</p>
<p>See <a href="qprocess.html#setStandardOutputFile">setStandardOutputFile</a>() for more information on how the file is opened.</p>
<p>Note: if <a href="qprocess.html#setProcessChannelMode">setProcessChannelMode</a>() was called with an argument of <a href="qprocess.html#ProcessChannelMode-enum">QProcess::MergedChannels</a>, this function has no effect.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qprocess.html#setStandardInputFile">setStandardInputFile</a>(), <a href="qprocess.html#setStandardOutputFile">setStandardOutputFile</a>(), and <a href="qprocess.html#setStandardOutputProcess">setStandardOutputProcess</a>().</p>
<!-- @@@setStandardErrorFile -->
<!-- $$$setStandardInputFile[overload1]$$$setStandardInputFileconstQString& -->
<h3 class="fn" id="setStandardInputFile"><a name="setStandardInputFile"></a><span class="type">void</span> QProcess::<span class="name">setStandardInputFile</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>fileName</i>)</h3>
<p>Redirects the process' standard input to the file indicated by <i>fileName</i>. When an input redirection is in place, the <a href="qprocess.html">QProcess</a> object will be in read-only mode (calling <a href="qiodevice.html#write">write</a>() will result in error).</p>
<p>To make the process read EOF right away, pass <a href="qprocess.html#nullDevice">nullDevice</a>() here. This is cleaner than using <a href="qprocess.html#closeWriteChannel">closeWriteChannel</a>() before writing any data, because it can be set up prior to starting the process.</p>
<p>If the file <i>fileName</i> does not exist at the moment <a href="qprocess.html#start">start</a>() is called or is not readable, starting the process will fail.</p>
<p>Calling setStandardInputFile() after the process has started has no effect.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qprocess.html#setStandardOutputFile">setStandardOutputFile</a>(), <a href="qprocess.html#setStandardErrorFile">setStandardErrorFile</a>(), and <a href="qprocess.html#setStandardOutputProcess">setStandardOutputProcess</a>().</p>
<!-- @@@setStandardInputFile -->
<!-- $$$setStandardOutputFile[overload1]$$$setStandardOutputFileconstQString&OpenMode -->
<h3 class="fn" id="setStandardOutputFile"><a name="setStandardOutputFile"></a><span class="type">void</span> QProcess::<span class="name">setStandardOutputFile</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>fileName</i>, <span class="type"><a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a></span> <i>mode</i> = Truncate)</h3>
<p>Redirects the process' standard output to the file <i>fileName</i>. When the redirection is in place, the standard output read channel is closed: reading from it using <a href="qiodevice.html#read">read</a>() will always fail, as will <a href="qprocess.html#readAllStandardOutput">readAllStandardOutput</a>().</p>
<p>To discard all standard output from the process, pass <a href="qprocess.html#nullDevice">nullDevice</a>() here. This is more efficient than simply never reading the standard output, as no <a href="qprocess.html">QProcess</a> buffers are filled.</p>
<p>If the file <i>fileName</i> doesn't exist at the moment <a href="qprocess.html#start">start</a>() is called, it will be created. If it cannot be created, the starting will fail.</p>
<p>If the file exists and <i>mode</i> is <a href="qiodevice.html#OpenModeFlag-enum">QIODevice::Truncate</a>, the file will be truncated. Otherwise (if <i>mode</i> is <a href="qiodevice.html#OpenModeFlag-enum">QIODevice::Append</a>), the file will be appended to.</p>
<p>Calling setStandardOutputFile() after the process has started has no effect.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qprocess.html#setStandardInputFile">setStandardInputFile</a>(), <a href="qprocess.html#setStandardErrorFile">setStandardErrorFile</a>(), and <a href="qprocess.html#setStandardOutputProcess">setStandardOutputProcess</a>().</p>
<!-- @@@setStandardOutputFile -->
<!-- $$$setStandardOutputProcess[overload1]$$$setStandardOutputProcessQProcess* -->
<h3 class="fn" id="setStandardOutputProcess"><a name="setStandardOutputProcess"></a><span class="type">void</span> QProcess::<span class="name">setStandardOutputProcess</span>(<span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> *<i>destination</i>)</h3>
<p>Pipes the standard output stream of this process to the <i>destination</i> process' standard input.</p>
<p>The following shell command:</p>
<pre class="cpp">

  command1 <span class="operator">|</span> command2

</pre>
<p>Can be accomplished with <a href="qprocess.html">QProcess</a> with the following code:</p>
<pre class="cpp">

  <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> process1;
  <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> process2;

  process1<span class="operator">.</span>setStandardOutputProcess(<span class="operator">&amp;</span>process2);

  process1<span class="operator">.</span>start(<span class="string">&quot;command1&quot;</span>);
  process2<span class="operator">.</span>start(<span class="string">&quot;command2&quot;</span>);

</pre>
<p>This function was introduced in  Qt 4.2.</p>
<!-- @@@setStandardOutputProcess -->
<!-- $$$setWorkingDirectory[overload1]$$$setWorkingDirectoryconstQString& -->
<h3 class="fn" id="setWorkingDirectory"><a name="setWorkingDirectory"></a><span class="type">void</span> QProcess::<span class="name">setWorkingDirectory</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>dir</i>)</h3>
<p>Sets the working directory to <i>dir</i>. <a href="qprocess.html">QProcess</a> will start the process in this directory. The default behavior is to start the process in the working directory of the calling process.</p>
<p><b>Note: </b>On QNX, this may cause all application threads to temporarily freeze.</p><p><b>See also </b><a href="qprocess.html#workingDirectory">workingDirectory</a>() and <a href="qprocess.html#start">start</a>().</p>
<!-- @@@setWorkingDirectory -->
<!-- $$$setupChildProcess[overload1]$$$setupChildProcess -->
<h3 class="fn" id="setupChildProcess"><a name="setupChildProcess"></a><code>[virtual protected] </code><span class="type">void</span> QProcess::<span class="name">setupChildProcess</span>()</h3>
<p>This function is called in the child process context just before the program is executed on Unix or macOS (i.e&#x2e;, after <code>fork()</code>, but before <code>execve()</code>). Reimplement this function to do last minute initialization of the child process. Example:</p>
<pre class="cpp">

  <span class="keyword">class</span> SandboxProcess : <span class="keyword">public</span> <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span>
  {
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
   <span class="keyword">protected</span>:
       <span class="type">void</span> setupChildProcess();
      <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
  };

  <span class="type">void</span> SandboxProcess<span class="operator">::</span>setupChildProcess()
  {
      <span class="comment">// Drop all privileges in the child process, and enter</span>
      <span class="comment">// a chroot jail.</span>
  <span class="preprocessor">#if defined Q_OS_UNIX</span>
      <span class="operator">::</span>setgroups(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      <span class="operator">::</span>chroot(<span class="string">&quot;/etc/safe&quot;</span>);
      <span class="operator">::</span>chdir(<span class="string">&quot;/&quot;</span>);
      <span class="operator">::</span>setgid(safeGid);
      <span class="operator">::</span>setuid(safeUid);
      <span class="operator">::</span>umask(<span class="number">0</span>);
  <span class="preprocessor">#endif</span>
  }

</pre>
<p>You cannot exit the process (by calling exit(), for instance) from this function. If you need to stop the program before it starts execution, your workaround is to emit <a href="qprocess.html#finished">finished</a>() and then call exit().</p>
<p><b>Warning:</b> This function is called by <a href="qprocess.html">QProcess</a> on Unix and macOS only. On Windows and QNX, it is not called.</p>
<!-- @@@setupChildProcess -->
<!-- $$$start[overload1]$$$startconstQString&constQStringList&OpenMode -->
<h3 class="fn" id="start"><a name="start"></a><span class="type">void</span> QProcess::<span class="name">start</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>program</i>, const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp;<i>arguments</i>, <span class="type"><a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a></span> <i>mode</i> = ReadWrite)</h3>
<p>Starts the given <i>program</i> in a new process, passing the command line arguments in <i>arguments</i>.</p>
<p>The <a href="qprocess.html">QProcess</a> object will immediately enter the Starting state. If the process starts successfully, <a href="qprocess.html">QProcess</a> will emit <a href="qprocess.html#started">started</a>(); otherwise, <a href="qprocess.html#errorOccurred">errorOccurred</a>() will be emitted.</p>
<p><b>Note: </b>Processes are started asynchronously, which means the <a href="qprocess.html#started">started</a>() and <a href="qprocess.html#errorOccurred">errorOccurred</a>() signals may be delayed. Call <a href="qprocess.html#waitForStarted">waitForStarted</a>() to make sure the process has started (or has failed to start) and those signals have been emitted.</p><p><b>Note: </b>No further splitting of the arguments is performed.</p><p><b>Windows:</b> The arguments are quoted and joined into a command line that is compatible with the <code>CommandLineToArgvW()</code> Windows function. For programs that have different command line quoting requirements, you need to use <a href="qprocess.html#setNativeArguments">setNativeArguments</a>(). One notable program that does not follow the <code>CommandLineToArgvW()</code> rules is cmd.exe and, by consequence, all batch scripts.</p>
<p>The <a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a> is set to <i>mode</i>.</p>
<p>If the <a href="qprocess.html">QProcess</a> object is already running a process, a warning may be printed at the console, and the existing process will continue running unaffected.</p>
<p><b>See also </b><a href="qprocess.html#processId">processId</a>(), <a href="qprocess.html#started">started</a>(), <a href="qprocess.html#waitForStarted">waitForStarted</a>(), and <a href="qprocess.html#setNativeArguments">setNativeArguments</a>().</p>
<!-- @@@start -->
<!-- $$$start$$$startconstQString&OpenMode -->
<h3 class="fn" id="start-1"><a name="start-1"></a><span class="type">void</span> QProcess::<span class="name">start</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>command</i>, <span class="type"><a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a></span> <i>mode</i> = ReadWrite)</h3>
<p>This is an overloaded function.</p>
<p>Starts the command <i>command</i> in a new process. The <a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a> is set to <i>mode</i>.</p>
<p><i>command</i> is a single string of text containing both the program name and its arguments. The arguments are separated by one or more spaces. For example:</p>
<pre class="cpp">

  <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> process;
  process<span class="operator">.</span>start(<span class="string">&quot;del /s *.txt&quot;</span>);
  <span class="comment">// same as process.start(&quot;del&quot;, QStringList() &lt;&lt; &quot;/s&quot; &lt;&lt; &quot;*.txt&quot;);</span>
  <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>

</pre>
<p>Arguments containing spaces must be quoted to be correctly supplied to the new process. For example:</p>
<pre class="cpp">

  <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> process;
  process<span class="operator">.</span>start(<span class="string">&quot;dir \&quot;My Documents\&quot;&quot;</span>);

</pre>
<p>Literal quotes in the <i>command</i> string are represented by triple quotes. For example:</p>
<pre class="cpp">

  <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span> process;
  process<span class="operator">.</span>start(<span class="string">&quot;dir \&quot;Epic 12\&quot;\&quot;\&quot; Singles\&quot;&quot;</span>);

</pre>
<p>After the <i>command</i> string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list.</p>
<p>You can disable this overload by defining <code>QT_NO_PROCESS_COMBINED_ARGUMENT_START</code> when you compile your applications. This can be useful if you want to ensure that you are not splitting arguments unintentionally, for example. In virtually all cases, using the other overload is the preferred method.</p>
<p>On operating systems where the system API for passing command line arguments to a subprocess natively uses a single string (Windows), one can conceive command lines which cannot be passed via <a href="qprocess.html">QProcess</a>'s portable list-based API. In these rare cases you need to use <a href="qprocess.html#setProgram">setProgram</a>() and <a href="qprocess.html#setNativeArguments">setNativeArguments</a>() instead of this function.</p>
<!-- @@@start -->
<!-- $$$start$$$startOpenMode -->
<h3 class="fn" id="start-2"><a name="start-2"></a><span class="type">void</span> QProcess::<span class="name">start</span>(<span class="type"><a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a></span> <i>mode</i> = ReadWrite)</h3>
<p>This is an overloaded function.</p>
<p>Starts the program set by <a href="qprocess.html#setProgram">setProgram</a>() with arguments set by <a href="qprocess.html#setArguments">setArguments</a>(). The <a href="qiodevice.html#OpenModeFlag-enum">OpenMode</a> is set to <i>mode</i>.</p>
<p>This function was introduced in  Qt 5.1.</p>
<p><b>See also </b><a href="qprocess.html#open">open</a>(), <a href="qprocess.html#setProgram">setProgram</a>(), and <a href="qprocess.html#setArguments">setArguments</a>().</p>
<!-- @@@start -->
<!-- $$$startDetached[overload1]$$$startDetachedconstQString&constQStringList&constQString&qint64* -->
<h3 class="fn" id="startDetached"><a name="startDetached"></a><code>[static] </code><span class="type">bool</span> QProcess::<span class="name">startDetached</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>program</i>, const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp;<i>arguments</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>workingDirectory</i> = QString(), <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> *<i>pid</i> = Q_NULLPTR)</h3>
<p>Starts the program <i>program</i> with the arguments <i>arguments</i> in a new process, and detaches from it. Returns <code>true</code> on success; otherwise returns <code>false</code>. If the calling process exits, the detached process will continue to run unaffected.</p>
<p>Argument handling is identical to the respective <a href="qprocess.html#start">start</a>() overload.</p>
<p><b>Unix:</b> The started process will run in its own session and act like a daemon.</p>
<p>The process will be started in the directory <i>workingDirectory</i>. If <i>workingDirectory</i> is empty, the working directory is inherited from the calling process.</p>
<p><b>Note: </b>On QNX, this may cause all application threads to temporarily freeze.</p><p>If the function is successful then *<i>pid</i> is set to the process identifier of the started process.</p>
<p><b>See also </b><a href="qprocess.html#start">start</a>().</p>
<!-- @@@startDetached -->
<!-- $$$startDetached$$$startDetachedconstQString& -->
<h3 class="fn" id="startDetached-1"><a name="startDetached-1"></a><code>[static] </code><span class="type">bool</span> QProcess::<span class="name">startDetached</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>command</i>)</h3>
<p>This is an overloaded function.</p>
<p>Starts the command <i>command</i> in a new process, and detaches from it. Returns <code>true</code> on success; otherwise returns <code>false</code>.</p>
<p>Argument handling is identical to the respective <a href="qprocess.html#start">start</a>() overload.</p>
<p>After the <i>command</i> string has been split and unquoted, this function behaves like the overload which takes the arguments as a string list.</p>
<p><b>See also </b><a href="qprocess.html#start-1">start</a>(const QString &amp;command, OpenMode mode).</p>
<!-- @@@startDetached -->
<!-- $$$started[overload1]$$$started -->
<h3 class="fn" id="started"><a name="started"></a><code>[signal] </code><span class="type">void</span> QProcess::<span class="name">started</span>()</h3>
<p>This signal is emitted by <a href="qprocess.html">QProcess</a> when the process has started, and <a href="qprocess.html#state">state</a>() returns <a href="qprocess.html#ProcessState-enum">Running</a>.</p>
<p><b>Note: </b>This is a private signal. It can be used in signal connections but cannot be emitted by the user.</p>
<!-- @@@started -->
<!-- $$$state[overload1]$$$state -->
<h3 class="fn" id="state"><a name="state"></a><span class="type"><a href="qprocess.html#ProcessState-enum">QProcess::ProcessState</a></span> QProcess::<span class="name">state</span>() const</h3>
<p>Returns the current state of the process.</p>
<p><b>See also </b><a href="qprocess.html#stateChanged">stateChanged</a>() and <a href="qprocess.html#error">error</a>().</p>
<!-- @@@state -->
<!-- $$$stateChanged[overload1]$$$stateChangedQProcess::ProcessState -->
<h3 class="fn" id="stateChanged"><a name="stateChanged"></a><code>[signal] </code><span class="type">void</span> QProcess::<span class="name">stateChanged</span>(<span class="type"><a href="qprocess.html#ProcessState-enum">QProcess::ProcessState</a></span> <i>newState</i>)</h3>
<p>This signal is emitted whenever the state of <a href="qprocess.html">QProcess</a> changes. The <i>newState</i> argument is the state <a href="qprocess.html">QProcess</a> changed to.</p>
<p><b>Note: </b>This is a private signal. It can be used in signal connections but cannot be emitted by the user.</p>
<!-- @@@stateChanged -->
<!-- $$$systemEnvironment[overload1]$$$systemEnvironment -->
<h3 class="fn" id="systemEnvironment"><a name="systemEnvironment"></a><code>[static] </code><span class="type"><a href="qstringlist.html">QStringList</a></span> QProcess::<span class="name">systemEnvironment</span>()</h3>
<p>Returns the environment of the calling process as a list of key=value pairs. Example:</p>
<pre class="cpp">

  <span class="type"><a href="qstringlist.html">QStringList</a></span> environment <span class="operator">=</span> <span class="type"><a href="qprocess.html#QProcess">QProcess</a></span><span class="operator">::</span>systemEnvironment();
  <span class="comment">// environment = {&quot;PATH=/usr/bin:/usr/local/bin&quot;,</span>
  <span class="comment">//                &quot;USER=greg&quot;, &quot;HOME=/home/greg&quot;}</span>

</pre>
<p>This function does not cache the system environment. Therefore, it's possible to obtain an updated version of the environment if low-level C library functions like <code>setenv</code> or <code>putenv</code> have been called.</p>
<p>However, note that repeated calls to this function will recreate the list of environment variables, which is a non-trivial operation.</p>
<p><b>Note: </b>For new code, it is recommended to use <a href="qprocessenvironment.html#systemEnvironment">QProcessEnvironment::systemEnvironment</a>()</p><p>This function was introduced in  Qt 4.1.</p>
<p><b>See also </b><a href="qprocessenvironment.html#systemEnvironment">QProcessEnvironment::systemEnvironment</a>() and <a href="qprocess.html#setProcessEnvironment">setProcessEnvironment</a>().</p>
<!-- @@@systemEnvironment -->
<!-- $$$terminate[overload1]$$$terminate -->
<h3 class="fn" id="terminate"><a name="terminate"></a><code>[slot] </code><span class="type">void</span> QProcess::<span class="name">terminate</span>()</h3>
<p>Attempts to terminate the process.</p>
<p>The process may not exit as a result of calling this function (it is given the chance to prompt the user for any unsaved files, etc).</p>
<p>On Windows, terminate() posts a WM_CLOSE message to all top-level windows of the process and then to the main thread of the process itself. On Unix and macOS the <code>SIGTERM</code> signal is sent.</p>
<p>Console applications on Windows that do not run an event loop, or whose event loop does not handle the WM_CLOSE message, can only be terminated by calling <a href="qprocess.html#kill">kill</a>().</p>
<p><b>See also </b><a href="qprocess.html#kill">kill</a>().</p>
<!-- @@@terminate -->
<!-- $$$waitForBytesWritten[overload1]$$$waitForBytesWrittenint -->
<h3 class="fn" id="waitForBytesWritten"><a name="waitForBytesWritten"></a><code>[virtual] </code><span class="type">bool</span> QProcess::<span class="name">waitForBytesWritten</span>(<span class="type">int</span> <i>msecs</i> = 30000)</h3>
<p>Reimplemented from <a href="qiodevice.html#waitForBytesWritten">QIODevice::waitForBytesWritten</a>().</p>
<!-- @@@waitForBytesWritten -->
<!-- $$$waitForFinished[overload1]$$$waitForFinishedint -->
<h3 class="fn" id="waitForFinished"><a name="waitForFinished"></a><span class="type">bool</span> QProcess::<span class="name">waitForFinished</span>(<span class="type">int</span> <i>msecs</i> = 30000)</h3>
<p>Blocks until the process has finished and the <a href="qprocess.html#finished">finished</a>() signal has been emitted, or until <i>msecs</i> milliseconds have passed.</p>
<p>Returns <code>true</code> if the process finished; otherwise returns <code>false</code> (if the operation timed out, if an error occurred, or if this <a href="qprocess.html">QProcess</a> is already finished).</p>
<p>This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.</p>
<p><b>Warning:</b> Calling this function from the main (GUI) thread might cause your user interface to freeze.</p>
<p>If msecs is -1, this function will not time out.</p>
<p><b>See also </b><a href="qprocess.html#finished">finished</a>(), <a href="qprocess.html#waitForStarted">waitForStarted</a>(), <a href="qprocess.html#waitForReadyRead">waitForReadyRead</a>(), and <a href="qprocess.html#waitForBytesWritten">waitForBytesWritten</a>().</p>
<!-- @@@waitForFinished -->
<!-- $$$waitForReadyRead[overload1]$$$waitForReadyReadint -->
<h3 class="fn" id="waitForReadyRead"><a name="waitForReadyRead"></a><code>[virtual] </code><span class="type">bool</span> QProcess::<span class="name">waitForReadyRead</span>(<span class="type">int</span> <i>msecs</i> = 30000)</h3>
<p>Reimplemented from <a href="qiodevice.html#waitForReadyRead">QIODevice::waitForReadyRead</a>().</p>
<!-- @@@waitForReadyRead -->
<!-- $$$waitForStarted[overload1]$$$waitForStartedint -->
<h3 class="fn" id="waitForStarted"><a name="waitForStarted"></a><span class="type">bool</span> QProcess::<span class="name">waitForStarted</span>(<span class="type">int</span> <i>msecs</i> = 30000)</h3>
<p>Blocks until the process has started and the <a href="qprocess.html#started">started</a>() signal has been emitted, or until <i>msecs</i> milliseconds have passed.</p>
<p>Returns <code>true</code> if the process was started successfully; otherwise returns <code>false</code> (if the operation timed out or if an error occurred).</p>
<p>This function can operate without an event loop. It is useful when writing non-GUI applications and when performing I/O operations in a non-GUI thread.</p>
<p><b>Warning:</b> Calling this function from the main (GUI) thread might cause your user interface to freeze.</p>
<p>If msecs is -1, this function will not time out.</p>
<p><b>Note: </b>On some UNIX operating systems, this function may return true but the process may later report a <a href="qprocess.html#ProcessError-enum">QProcess::FailedToStart</a> error.</p><p><b>See also </b><a href="qprocess.html#started">started</a>(), <a href="qprocess.html#waitForReadyRead">waitForReadyRead</a>(), <a href="qprocess.html#waitForBytesWritten">waitForBytesWritten</a>(), and <a href="qprocess.html#waitForFinished">waitForFinished</a>().</p>
<!-- @@@waitForStarted -->
<!-- $$$workingDirectory[overload1]$$$workingDirectory -->
<h3 class="fn" id="workingDirectory"><a name="workingDirectory"></a><span class="type"><a href="qstring.html">QString</a></span> QProcess::<span class="name">workingDirectory</span>() const</h3>
<p>If <a href="qprocess.html">QProcess</a> has been assigned a working directory, this function returns the working directory that the <a href="qprocess.html">QProcess</a> will enter before the program has started. Otherwise, (i.e&#x2e;, no directory has been assigned,) an empty string is returned, and <a href="qprocess.html">QProcess</a> will use the application's current working directory instead.</p>
<p><b>See also </b><a href="qprocess.html#setWorkingDirectory">setWorkingDirectory</a>().</p>
<!-- @@@workingDirectory -->
<!-- $$$writeData[overload1]$$$writeDataconstchar*qint64 -->
<h3 class="fn" id="writeData"><a name="writeData"></a><code>[virtual protected] </code><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QProcess::<span class="name">writeData</span>(const <span class="type">char</span> *<i>data</i>, <span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>len</i>)</h3>
<p>Reimplemented from <a href="qiodevice.html#writeData">QIODevice::writeData</a>().</p>
<!-- @@@writeData -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$Q_PID -->
<h3 class="fn" id="Q_PID-typedef"><a name="Q_PID-typedef"></a>typedef <span class="name">Q_PID</span></h3>
<p>Typedef for the identifiers used to represent processes on the underlying platform. On Unix, this corresponds to <a href="qtglobal.html#qint64-typedef">qint64</a>; on Windows, it corresponds to <code>_PROCESS_INFORMATION*</code>.</p>
<p><b>See also </b><a href="qprocess-obsolete.html#pid">QProcess::pid</a>().</p>
<!-- @@@Q_PID -->
</div>
<div class="macros">
<h2>Macro Documentation</h2>
<!-- $$$QT_NO_PROCESS_COMBINED_ARGUMENT_START[overload1]$$$QT_NO_PROCESS_COMBINED_ARGUMENT_START -->
<h3 class="fn" id="QT_NO_PROCESS_COMBINED_ARGUMENT_START"><a name="QT_NO_PROCESS_COMBINED_ARGUMENT_START"></a><span class="name">QT_NO_PROCESS_COMBINED_ARGUMENT_START</span></h3>
<p>Disables the <a href="qprocess.html#start-1">QProcess::start()</a> overload taking a single string. In most cases where it is used, the user intends for the first argument to be treated atomically as per the other overload.</p>
<p>This function was introduced in  Qt 5.6.</p>
<p><b>See also </b><a href="qprocess.html#start-1">QProcess::start</a>(const QString &amp;command, OpenMode mode).</p>
<!-- @@@QT_NO_PROCESS_COMBINED_ARGUMENT_START -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>