Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 4623

qt-doc-4.8.5-10.fc18.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- q3process.cpp -->
  <title>Qt 4.8: Q3Process Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li>Qt3SupportLight</li>
<li>Q3Process</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<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="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#notes-for-windows-users">Notes for Windows users</a></li>
</ul>
</div>
<h1 class="title">Q3Process Class Reference</h1>
<!-- $$$Q3Process-brief -->
<p>The Q3Process class is used to start external programs and to communicate with them. <a href="#details">More...</a></p>
<!-- @@@Q3Process -->
<pre class="cpp"> <span class="preprocessor">#include &lt;Q3Process&gt;</span></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html#qprocess">Porting to Qt 4</a> for more information.</p>
<p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p>
<ul>
<li><a href="q3process-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#Communication-enum">Communication</a></b> { Stdin, Stdout, Stderr, DupStderr }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#Q3Process">Q3Process</a></b> ( QObject * <i>parent</i> = 0, const char * <i>name</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#Q3Process-2">Q3Process</a></b> ( const QString &amp; <i>arg0</i>, QObject * <i>parent</i> = 0, const char * <i>name</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#Q3Process-3">Q3Process</a></b> ( const QStringList &amp; <i>args</i>, QObject * <i>parent</i> = 0, const char * <i>name</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#dtor.Q3Process">~Q3Process</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#addArgument">addArgument</a></b> ( const QString &amp; <i>arg</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#arguments">arguments</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#canReadLineStderr">canReadLineStderr</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#canReadLineStdout">canReadLineStdout</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#clearArguments">clearArguments</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#communication">communication</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#exitStatus">exitStatus</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#isRunning">isRunning</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#launch">launch</a></b> ( const QByteArray &amp; <i>buf</i>, QStringList * <i>env</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#launch-2">launch</a></b> ( const QString &amp; <i>buf</i>, QStringList * <i>env</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#normalExit">normalExit</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> PID </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#processIdentifier">processIdentifier</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#readLineStderr">readLineStderr</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#readLineStdout">readLineStdout</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QByteArray </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#readStderr">readStderr</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QByteArray </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#readStdout">readStdout</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#setArguments">setArguments</a></b> ( const QStringList &amp; <i>args</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#setCommunication">setCommunication</a></b> ( int <i>commFlags</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#setWorkingDirectory">setWorkingDirectory</a></b> ( const QDir &amp; <i>dir</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#start">start</a></b> ( QStringList * <i>env</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDir </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#workingDirectory">workingDirectory</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#closeStdin">closeStdin</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#kill">kill</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#tryTerminate">tryTerminate</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#writeToStdin">writeToStdin</a></b> ( const QByteArray &amp; <i>buf</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#writeToStdin-2">writeToStdin</a></b> ( const QString &amp; <i>buf</i> )</td></tr>
</table>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#launchFinished">launchFinished</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#processExited">processExited</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#readyReadStderr">readyReadStderr</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#readyReadStdout">readyReadStdout</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#wroteToStdin">wroteToStdin</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#connectNotify">connectNotify</a></b> ( const char * <i>signal</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3process.html#disconnectNotify">disconnectNotify</a></b> ( const char * <i>signal</i> )</td></tr>
</table>
<ul>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$Q3Process-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3Process class is used to start external programs and to communicate with them.</p>
<p>You can write to the started program's standard input, and can read the program's standard output and standard error. You can pass command line arguments to the program either in the constructor or with <a href="q3process.html#setArguments">setArguments</a>() or <a href="q3process.html#addArgument">addArgument</a>(). The program's working directory can be set with <a href="q3process.html#setWorkingDirectory">setWorkingDirectory</a>(). If you need to set up environment variables pass them to the <a href="q3process.html#start">start</a>() or <a href="q3process.html#launch">launch</a>() functions (see below). The <a href="q3process.html#processExited">processExited</a>() signal is emitted if the program exits. The program's exit status is available from <a href="q3process.html#exitStatus">exitStatus</a>(), although you could simply call <a href="q3process.html#normalExit">normalExit</a>() to see if the program terminated normally.</p>
<p>There are two different ways to start a process. If you just want to run a program, optionally passing data to its standard input at the beginning, use one of the <a href="q3process.html#launch">launch</a>() functions. If you want full control of the program's standard input (especially if you don't know all the data you want to send to standard input at the beginning), use the <a href="q3process.html#start">start</a>() function.</p>
<p>If you use <a href="q3process.html#start">start</a>() you can write to the program's standard input using <a href="q3process.html#writeToStdin">writeToStdin</a>() and you can close the standard input with <a href="q3process.html#closeStdin">closeStdin</a>(). The <a href="q3process.html#wroteToStdin">wroteToStdin</a>() signal is emitted if the data sent to standard input has been written. You can read from the program's standard output using <a href="q3process.html#readStdout">readStdout</a>() or <a href="q3process.html#readLineStdout">readLineStdout</a>(). These functions return an empty <a href="qbytearray.html">QByteArray</a> if there is no data to read. The <a href="q3process.html#readyReadStdout">readyReadStdout</a>() signal is emitted when there is data available to be read from standard output. Standard error has a set of functions that correspond to the standard output functions, i.e&#x2e; <a href="q3process.html#readStderr">readStderr</a>(), <a href="q3process.html#readLineStderr">readLineStderr</a>() and <a href="q3process.html#readyReadStderr">readyReadStderr</a>().</p>
<p>If you use one of the <a href="q3process.html#launch">launch</a>() functions the data you pass will be sent to the program's standard input which will be closed once all the data has been written. You should <i>not</i> use <a href="q3process.html#writeToStdin">writeToStdin</a>() or <a href="q3process.html#closeStdin">closeStdin</a>() if you use <a href="q3process.html#launch">launch</a>(). If you need to send data to the program's standard input after it has started running use <a href="q3process.html#start">start</a>() instead of <a href="q3process.html#launch">launch</a>().</p>
<p>Both <a href="q3process.html#start">start</a>() and <a href="q3process.html#launch">launch</a>() can accept a string list of strings each of which has the format, key=value, where the keys are the names of environment variables.</p>
<p>You can test to see if a program is running with <a href="q3process.html#isRunning">isRunning</a>(). The program's process identifier is available from <a href="q3process.html#processIdentifier">processIdentifier</a>(). If you want to terminate a running program use <a href="q3process.html#tryTerminate">tryTerminate</a>(), but note that the program may ignore this. If you <i>really</i> want to terminate the program, without it having any chance to clean up, you can use <a href="q3process.html#kill">kill</a>().</p>
<p>Although you may need quotes for a file named on the command line (e.g&#x2e; if it contains spaces) you shouldn't use extra quotes for arguments passed to <a href="q3process.html#addArgument">addArgument</a>() or <a href="q3process.html#setArguments">setArguments</a>().</p>
<p>The <a href="q3process.html#readyReadStdout">readyReadStdout</a>() signal is emitted when there is new data on standard output. This happens asynchronously: you don't know if more data will arrive later.</p>
<p>In the above example you could connect the <a href="q3process.html#processExited">processExited</a>() signal to the slot UicManager::readFromStdout() instead. If you do so, you will be certain that all the data is available when the slot is called. On the other hand, you must wait until the process has finished before doing any processing.</p>
<p>Note that if you are expecting a lot of output from the process, you may hit platform-dependent limits to the pipe buffer size. The solution is to make sure you connect to the output, e.g&#x2e; the <a href="q3process.html#readyReadStdout">readyReadStdout</a>() and <a href="q3process.html#readyReadStderr">readyReadStderr</a>() signals and read the data as soon as it becomes available.</p>
<p>Please note that Q3Process does not emulate a shell. This means that Q3Process does not do any expansion of arguments: a '*' is passed as a '*' to the program and is <i>not</i> replaced by all the files, a '$HOME' is also passed literally and is <i>not</i> replaced by the environment variable HOME and the special characters for IO redirection ('&gt;', '|', etc.) are also passed literally and do <i>not</i> have the special meaning as they have in a shell.</p>
<p>Also note that Q3Process does not emulate a terminal. This means that certain programs which need direct terminal control, do not work as expected with Q3Process. Such programs include console email programs (like pine and mutt) but also programs which require the user to enter a password (like su and ssh).</p>
<a name="notes-for-windows-users"></a>
<h3>Notes for Windows users</h3>
<p>Some Windows commands, for example, <tt>dir</tt>, are not provided by separate applications, but by the command interpreter. If you attempt to use Q3Process to execute these commands directly it won't work. One possible solution is to execute the command interpreter itself (<tt>cmd.exe</tt> on some Windows systems), and ask the interpreter to execute the desired command.</p>
<p>Under Windows there are certain problems starting 16-bit applications and capturing their output. Microsoft recommends using an intermediate application to start 16-bit applications.</p>
</div>
<p><b>See also </b><a href="q3socket.html">Q3Socket</a>.</p>
<!-- @@@Q3Process -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Communication$$$Stdin$$$Stdout$$$Stderr$$$DupStderr -->
<h3 class="fn"><a name="Communication-enum"></a>enum Q3Process::<span class="name">Communication</span></h3>
<p>This enum type defines the communication channels connected to the process.</p>
<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"><tt>Q3Process::Stdin</tt></td><td class="topAlign"><tt>0x01</tt></td><td class="topAlign">Data can be written to the process's standard input.</td></tr>
<tr><td class="topAlign"><tt>Q3Process::Stdout</tt></td><td class="topAlign"><tt>0x02</tt></td><td class="topAlign">Data can be read from the process's standard output.</td></tr>
<tr><td class="topAlign"><tt>Q3Process::Stderr</tt></td><td class="topAlign"><tt>0x04</tt></td><td class="topAlign">Data can be read from the process's standard error.</td></tr>
<tr><td class="topAlign"><tt>Q3Process::DupStderr</tt></td><td class="topAlign"><tt>0x08</tt></td><td class="topAlign">Both the process's standard error output <i>and</i> its standard output are written to its standard output. (Like Unix's dup2().) This means that nothing is sent to the standard error output. This is especially useful if your application requires that the output on standard output and on standard error must be read in the same order that they are produced. This is a flag, so to activate it you must pass <tt>Stdout|Stderr|DupStderr</tt>, or <tt>Stdin|Stdout|Stderr|DupStderr</tt> if you want to provide input, to the <a href="q3process.html#setCommunication">setCommunication</a>() call.</td></tr>
</table>
<p><b>See also </b><a href="q3process.html#setCommunication">setCommunication</a>() and <a href="q3process.html#communication">communication</a>().</p>
<!-- @@@Communication -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3Process[overload1]$$$Q3ProcessQObject*constchar* -->
<h3 class="fn"><a name="Q3Process"></a>Q3Process::<span class="name">Q3Process</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0, const <span class="type">char</span> * <i>name</i> = 0 )</h3>
<p>Constructs a <a href="q3process.html" class="compat">Q3Process</a> object. The <i>parent</i> and <i>name</i> parameters are passed to the <a href="qobject.html">QObject</a> constructor.</p>
<p><b>See also </b><a href="q3process.html#setArguments">setArguments</a>(), <a href="q3process.html#addArgument">addArgument</a>(), and <a href="q3process.html#start">start</a>().</p>
<!-- @@@Q3Process -->
<!-- $$$Q3Process$$$Q3ProcessconstQString&QObject*constchar* -->
<h3 class="fn"><a name="Q3Process-2"></a>Q3Process::<span class="name">Q3Process</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>arg0</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0, const <span class="type">char</span> * <i>name</i> = 0 )</h3>
<p>Constructs a <a href="q3process.html" class="compat">Q3Process</a> with <i>arg0</i> as the command to be executed. The <i>parent</i> and <i>name</i> parameters are passed to the <a href="qobject.html">QObject</a> constructor.</p>
<p>The process is not started. You must call <a href="q3process.html#start">start</a>() or <a href="q3process.html#launch">launch</a>() to start the process.</p>
<p><b>See also </b><a href="q3process.html#setArguments">setArguments</a>(), <a href="q3process.html#addArgument">addArgument</a>(), and <a href="q3process.html#start">start</a>().</p>
<!-- @@@Q3Process -->
<!-- $$$Q3Process$$$Q3ProcessconstQStringList&QObject*constchar* -->
<h3 class="fn"><a name="Q3Process-3"></a>Q3Process::<span class="name">Q3Process</span> ( const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp; <i>args</i>, <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0, const <span class="type">char</span> * <i>name</i> = 0 )</h3>
<p>Constructs a <a href="q3process.html" class="compat">Q3Process</a> with <i>args</i> as the arguments of the process. The first element in the list is the command to be executed. The other elements in the list are the arguments to this command. The <i>parent</i> and <i>name</i> parameters are passed to the <a href="qobject.html">QObject</a> constructor.</p>
<p>The process is not started. You must call <a href="q3process.html#start">start</a>() or <a href="q3process.html#launch">launch</a>() to start the process.</p>
<p><b>See also </b><a href="q3process.html#setArguments">setArguments</a>(), <a href="q3process.html#addArgument">addArgument</a>(), and <a href="q3process.html#start">start</a>().</p>
<!-- @@@Q3Process -->
<!-- $$$~Q3Process[overload1]$$$~Q3Process -->
<h3 class="fn"><a name="dtor.Q3Process"></a>Q3Process::<span class="name">~Q3Process</span> ()</h3>
<p>Destroys the instance.</p>
<p>If the process is running, it is &lt;b&gt;not&lt;/b&gt; terminated! The standard input, standard output and standard error of the process are closed.</p>
<p>You can connect the <a href="qobject.html#destroyed">destroyed</a>() signal to the <a href="q3process.html#kill">kill</a>() slot, if you want the process to be terminated automatically when the instance is destroyed.</p>
<p><b>See also </b><a href="q3process.html#tryTerminate">tryTerminate</a>() and <a href="q3process.html#kill">kill</a>().</p>
<!-- @@@~Q3Process -->
<!-- $$$addArgument[overload1]$$$addArgumentconstQString& -->
<h3 class="fn"><a name="addArgument"></a><span class="type">void</span> Q3Process::<span class="name">addArgument</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>arg</i> )<tt> [virtual]</tt></h3>
<p>Adds <i>arg</i> to the end of the list of arguments.</p>
<p>The first element in the list of arguments is the command to be executed; the following elements are the command's arguments.</p>
<p><b>See also </b><a href="q3process.html#arguments">arguments</a>() and <a href="q3process.html#setArguments">setArguments</a>().</p>
<!-- @@@addArgument -->
<!-- $$$arguments[overload1]$$$arguments -->
<h3 class="fn"><a name="arguments"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> Q3Process::<span class="name">arguments</span> () const</h3>
<p>Returns the list of arguments that are set for the process. Arguments can be specified with the constructor or with the functions <a href="q3process.html#setArguments">setArguments</a>() and <a href="q3process.html#addArgument">addArgument</a>().</p>
<p>Note that if you want to iterate over the list, you should iterate over a copy, e.g&#x2e;</p>
<pre class="cpp"> <span class="type"><a href="qstringlist.html">QStringList</a></span> list <span class="operator">=</span> myProcess<span class="operator">.</span>arguments();
 <span class="type"><a href="qstringlist.html">QStringList</a></span><span class="operator">::</span>Iterator it <span class="operator">=</span> list<span class="operator">.</span>begin();
 <span class="keyword">while</span>( it <span class="operator">!</span><span class="operator">=</span> list<span class="operator">.</span>end() ) {
     myProcessing( <span class="operator">*</span>it );
     <span class="operator">+</span><span class="operator">+</span>it;
 }</pre>
<p><b>See also </b><a href="q3process.html#setArguments">setArguments</a>() and <a href="q3process.html#addArgument">addArgument</a>().</p>
<!-- @@@arguments -->
<!-- $$$canReadLineStderr[overload1]$$$canReadLineStderr -->
<h3 class="fn"><a name="canReadLineStderr"></a><span class="type">bool</span> Q3Process::<span class="name">canReadLineStderr</span> () const</h3>
<p>Returns true if it's possible to read an entire line of text from standard error at this time; otherwise returns false.</p>
<p><b>See also </b><a href="q3process.html#readLineStderr">readLineStderr</a>() and <a href="q3process.html#canReadLineStdout">canReadLineStdout</a>().</p>
<!-- @@@canReadLineStderr -->
<!-- $$$canReadLineStdout[overload1]$$$canReadLineStdout -->
<h3 class="fn"><a name="canReadLineStdout"></a><span class="type">bool</span> Q3Process::<span class="name">canReadLineStdout</span> () const</h3>
<p>Returns true if it's possible to read an entire line of text from standard output at this time; otherwise returns false.</p>
<p><b>See also </b><a href="q3process.html#readLineStdout">readLineStdout</a>() and <a href="q3process.html#canReadLineStderr">canReadLineStderr</a>().</p>
<!-- @@@canReadLineStdout -->
<!-- $$$clearArguments[overload1]$$$clearArguments -->
<h3 class="fn"><a name="clearArguments"></a><span class="type">void</span> Q3Process::<span class="name">clearArguments</span> ()</h3>
<p>Clears the list of arguments that are set for the process.</p>
<p><b>See also </b><a href="q3process.html#setArguments">setArguments</a>() and <a href="q3process.html#addArgument">addArgument</a>().</p>
<!-- @@@clearArguments -->
<!-- $$$closeStdin[overload1]$$$closeStdin -->
<h3 class="fn"><a name="closeStdin"></a><span class="type">void</span> Q3Process::<span class="name">closeStdin</span> ()<tt> [virtual slot]</tt></h3>
<p>Closes the process's standard input.</p>
<p>This function also deletes any pending data that has not been written to standard input.</p>
<p><b>See also </b><a href="q3process.html#wroteToStdin">wroteToStdin</a>().</p>
<!-- @@@closeStdin -->
<!-- $$$communication[overload1]$$$communication -->
<h3 class="fn"><a name="communication"></a><span class="type">int</span> Q3Process::<span class="name">communication</span> () const</h3>
<p>Returns the communication required with the process, i.e&#x2e; some combination of the <tt>Communication</tt> flags.</p>
<p><b>See also </b><a href="q3process.html#setCommunication">setCommunication</a>().</p>
<!-- @@@communication -->
<!-- $$$connectNotify[overload1]$$$connectNotifyconstchar* -->
<h3 class="fn"><a name="connectNotify"></a><span class="type">void</span> Q3Process::<span class="name">connectNotify</span> ( const <span class="type">char</span> * <i>signal</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#connectNotify">QObject::connectNotify</a>().</p>
<!-- @@@connectNotify -->
<!-- $$$disconnectNotify[overload1]$$$disconnectNotifyconstchar* -->
<h3 class="fn"><a name="disconnectNotify"></a><span class="type">void</span> Q3Process::<span class="name">disconnectNotify</span> ( const <span class="type">char</span> * <i>signal</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#disconnectNotify">QObject::disconnectNotify</a>().</p>
<!-- @@@disconnectNotify -->
<!-- $$$exitStatus[overload1]$$$exitStatus -->
<h3 class="fn"><a name="exitStatus"></a><span class="type">int</span> Q3Process::<span class="name">exitStatus</span> () const</h3>
<p>Returns the exit status of the process or 0 if the process is still running. This function returns immediately and does not wait until the process is finished.</p>
<p>If <a href="q3process.html#normalExit">normalExit</a>() is false (e.g&#x2e; if the program was killed or crashed), this function returns 0, so you should check the return value of <a href="q3process.html#normalExit">normalExit</a>() before relying on this value.</p>
<p><b>See also </b><a href="q3process.html#normalExit">normalExit</a>() and <a href="q3process.html#processExited">processExited</a>().</p>
<!-- @@@exitStatus -->
<!-- $$$isRunning[overload1]$$$isRunning -->
<h3 class="fn"><a name="isRunning"></a><span class="type">bool</span> Q3Process::<span class="name">isRunning</span> () const</h3>
<p>Returns true if the process is running; otherwise returns false.</p>
<p><b>See also </b><a href="q3process.html#normalExit">normalExit</a>(), <a href="q3process.html#exitStatus">exitStatus</a>(), and <a href="q3process.html#processExited">processExited</a>().</p>
<!-- @@@isRunning -->
<!-- $$$kill[overload1]$$$kill -->
<h3 class="fn"><a name="kill"></a><span class="type">void</span> Q3Process::<span class="name">kill</span> () const<tt> [slot]</tt></h3>
<p>Terminates the process. This is not a safe way to end a process since the process will not be able to do any cleanup. <a href="q3process.html#tryTerminate">tryTerminate</a>() is safer, but processes can ignore a <a href="q3process.html#tryTerminate">tryTerminate</a>().</p>
<p>The nice way to end a process and to be sure that it is finished, is to do something like this:</p>
<pre class="cpp"> process<span class="operator">-</span><span class="operator">&gt;</span><a href="q3process.html#tryTerminate">tryTerminate</a>();
 <span class="type"><a href="qtimer.html">QTimer</a></span><span class="operator">::</span>singleShot( <span class="number">5000</span><span class="operator">,</span> process<span class="operator">,</span> SLOT(kill()) );</pre>
<p>This tries to terminate the process the nice way. If the process is still running after 5 seconds, it terminates the process the hard way. The timeout should be chosen depending on the time the process needs to do all its cleanup: use a higher value if the process is likely to do a lot of computation or I/O on cleanup.</p>
<p>The slot returns immediately: it does not wait until the process has finished. When the process terminates, the <a href="q3process.html#processExited">processExited</a>() signal is emitted.</p>
<p><b>See also </b><a href="q3process.html#tryTerminate">tryTerminate</a>() and <a href="q3process.html#processExited">processExited</a>().</p>
<!-- @@@kill -->
<!-- $$$launch[overload1]$$$launchconstQByteArray&QStringList* -->
<h3 class="fn"><a name="launch"></a><span class="type">bool</span> Q3Process::<span class="name">launch</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>buf</i>, <span class="type"><a href="qstringlist.html">QStringList</a></span> * <i>env</i> = 0 )<tt> [virtual]</tt></h3>
<p>Runs the process and writes the data <i>buf</i> to the process's standard input. If all the data is written to standard input, standard input is closed. The command is searched for in the path for executable programs; you can also use an absolute path in the command itself.</p>
<p>If <i>env</i> is null, then the process is started with the same environment as the starting process. If <i>env</i> is non-null, then the values in the string list are interpreted as environment setttings of the form <tt>key=value</tt> and the process is started with these environment settings. For convenience, there is a small exception to this rule under Unix: if <i>env</i> does not contain any settings for the environment variable <tt>LD_LIBRARY_PATH</tt>, then this variable is inherited from the starting process.</p>
<p>Returns true if the process could be started; otherwise returns false.</p>
<p>Note that you should not use the slots <a href="q3process.html#writeToStdin">writeToStdin</a>() and <a href="q3process.html#closeStdin">closeStdin</a>() on processes started with launch(), since the result is not well-defined. If you need these slots, use <a href="q3process.html#start">start</a>() instead.</p>
<p>The process may or may not read the <i>buf</i> data sent to its standard input.</p>
<p>You can call this function even when a process that was started with this instance is still running. Be aware that if you do this the standard input of the process that was launched first will be closed, with any pending data being deleted, and the process will be left to run out of your control. Similarly, if the process could not be started the standard input will be closed and the pending data deleted. (On operating systems that have zombie processes, Qt will also wait() on the old process.)</p>
<p>The object emits the signal <a href="q3process.html#launchFinished">launchFinished</a>() when this function call is finished. If the start was successful, this signal is emitted after all the data has been written to standard input. If the start failed, then this signal is emitted immediately.</p>
<p><b>See also </b><a href="q3process.html#start">start</a>() and <a href="q3process.html#launchFinished">launchFinished</a>().</p>
<!-- @@@launch -->
<!-- $$$launch$$$launchconstQString&QStringList* -->
<h3 class="fn"><a name="launch-2"></a><span class="type">bool</span> Q3Process::<span class="name">launch</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>buf</i>, <span class="type"><a href="qstringlist.html">QStringList</a></span> * <i>env</i> = 0 )<tt> [virtual]</tt></h3>
<p>This is an overloaded function.</p>
<p>The data <i>buf</i> is written to standard input with <a href="q3process.html#writeToStdin">writeToStdin</a>() using the <a href="qstring-qt3.html#local8Bit" class="compat">QString::local8Bit</a>() representation of the strings.</p>
<!-- @@@launch -->
<!-- $$$launchFinished[overload1]$$$launchFinished -->
<h3 class="fn"><a name="launchFinished"></a><span class="type">void</span> Q3Process::<span class="name">launchFinished</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted when the process was started with <a href="q3process.html#launch">launch</a>(). If the start was successful, this signal is emitted after all the data has been written to standard input. If the start failed, then this signal is emitted immediately.</p>
<p>This signal is especially useful if you want to know when you can safely delete the <a href="q3process.html" class="compat">Q3Process</a> object when you are not interested in reading from standard output or standard error.</p>
<p><b>See also </b><a href="q3process.html#launch">launch</a>() and <a href="qobject.html#deleteLater">QObject::deleteLater</a>().</p>
<!-- @@@launchFinished -->
<!-- $$$normalExit[overload1]$$$normalExit -->
<h3 class="fn"><a name="normalExit"></a><span class="type">bool</span> Q3Process::<span class="name">normalExit</span> () const</h3>
<p>Returns true if the process has exited normally; otherwise returns false. This implies that this function returns false if the process is still running.</p>
<p><b>See also </b><a href="q3process.html#isRunning">isRunning</a>(), <a href="q3process.html#exitStatus">exitStatus</a>(), and <a href="q3process.html#processExited">processExited</a>().</p>
<!-- @@@normalExit -->
<!-- $$$processExited[overload1]$$$processExited -->
<h3 class="fn"><a name="processExited"></a><span class="type">void</span> Q3Process::<span class="name">processExited</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted when the process has exited.</p>
<p><b>See also </b><a href="q3process.html#isRunning">isRunning</a>(), <a href="q3process.html#normalExit">normalExit</a>(), <a href="q3process.html#exitStatus">exitStatus</a>(), <a href="q3process.html#start">start</a>(), and <a href="q3process.html#launch">launch</a>().</p>
<!-- @@@processExited -->
<!-- $$$processIdentifier[overload1]$$$processIdentifier -->
<h3 class="fn"><a name="processIdentifier"></a><span class="type">PID</span> Q3Process::<span class="name">processIdentifier</span> ()</h3>
<p>Returns platform dependent information about the process. This can be used together with platform specific system calls.</p>
<p>Under Unix the return value is the PID of the process, or -1 if no process belongs to this object.</p>
<p>Under Windows it is a pointer to the <tt>PROCESS_INFORMATION</tt> struct, or 0 if no process is belongs to this object.</p>
<p>Use of this function's return value is likely to be non-portable.</p>
<!-- @@@processIdentifier -->
<!-- $$$readLineStderr[overload1]$$$readLineStderr -->
<h3 class="fn"><a name="readLineStderr"></a><span class="type"><a href="qstring.html">QString</a></span> Q3Process::<span class="name">readLineStderr</span> ()<tt> [virtual]</tt></h3>
<p>Reads a line of text from standard error, excluding any trailing newline or carriage return characters and returns it. Returns an empty string if <a href="q3process.html#canReadLineStderr">canReadLineStderr</a>() returns false.</p>
<p>By default, the text is interpreted to be in Latin-1 encoding. If you need other codecs, you can set a different codec with <a href="qtextcodec.html#setCodecForCStrings">QTextCodec::setCodecForCStrings</a>().</p>
<p><b>See also </b><a href="q3process.html#canReadLineStderr">canReadLineStderr</a>(), <a href="q3process.html#readyReadStderr">readyReadStderr</a>(), <a href="q3process.html#readStderr">readStderr</a>(), and <a href="q3process.html#readLineStdout">readLineStdout</a>().</p>
<!-- @@@readLineStderr -->
<!-- $$$readLineStdout[overload1]$$$readLineStdout -->
<h3 class="fn"><a name="readLineStdout"></a><span class="type"><a href="qstring.html">QString</a></span> Q3Process::<span class="name">readLineStdout</span> ()<tt> [virtual]</tt></h3>
<p>Reads a line of text from standard output, excluding any trailing newline or carriage return characters, and returns it. Returns an empty string if <a href="q3process.html#canReadLineStdout">canReadLineStdout</a>() returns false.</p>
<p>By default, the text is interpreted to be in Latin-1 encoding. If you need other codecs, you can set a different codec with <a href="qtextcodec.html#setCodecForCStrings">QTextCodec::setCodecForCStrings</a>().</p>
<p><b>See also </b><a href="q3process.html#canReadLineStdout">canReadLineStdout</a>(), <a href="q3process.html#readyReadStdout">readyReadStdout</a>(), <a href="q3process.html#readStdout">readStdout</a>(), and <a href="q3process.html#readLineStderr">readLineStderr</a>().</p>
<!-- @@@readLineStdout -->
<!-- $$$readStderr[overload1]$$$readStderr -->
<h3 class="fn"><a name="readStderr"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> Q3Process::<span class="name">readStderr</span> ()<tt> [virtual]</tt></h3>
<p>Reads the data that the process has written to standard error. When new data is written to standard error, the class emits the signal <a href="q3process.html#readyReadStderr">readyReadStderr</a>().</p>
<p>If there is no data to read, this function returns a <a href="qbytearray.html">QByteArray</a> of size 0: it does not wait until there is something to read.</p>
<p><b>See also </b><a href="q3process.html#readyReadStderr">readyReadStderr</a>(), <a href="q3process.html#readLineStderr">readLineStderr</a>(), <a href="q3process.html#readStdout">readStdout</a>(), and <a href="q3process.html#writeToStdin">writeToStdin</a>().</p>
<!-- @@@readStderr -->
<!-- $$$readStdout[overload1]$$$readStdout -->
<h3 class="fn"><a name="readStdout"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> Q3Process::<span class="name">readStdout</span> ()<tt> [virtual]</tt></h3>
<p>Reads the data that the process has written to standard output. When new data is written to standard output, the class emits the signal <a href="q3process.html#readyReadStdout">readyReadStdout</a>().</p>
<p>If there is no data to read, this function returns a <a href="qbytearray.html">QByteArray</a> of size 0: it does not wait until there is something to read.</p>
<p><b>See also </b><a href="q3process.html#readyReadStdout">readyReadStdout</a>(), <a href="q3process.html#readLineStdout">readLineStdout</a>(), <a href="q3process.html#readStderr">readStderr</a>(), and <a href="q3process.html#writeToStdin">writeToStdin</a>().</p>
<!-- @@@readStdout -->
<!-- $$$readyReadStderr[overload1]$$$readyReadStderr -->
<h3 class="fn"><a name="readyReadStderr"></a><span class="type">void</span> Q3Process::<span class="name">readyReadStderr</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted when the process has written data to standard error. You can read the data with <a href="q3process.html#readStderr">readStderr</a>().</p>
<p>Note that this signal is only emitted when there is new data and not when there is old, but unread data. In the slot connected to this signal, you should always read everything that is available at that moment to make sure that you don't lose any data.</p>
<p><b>See also </b><a href="q3process.html#readStderr">readStderr</a>(), <a href="q3process.html#readLineStderr">readLineStderr</a>(), and <a href="q3process.html#readyReadStdout">readyReadStdout</a>().</p>
<!-- @@@readyReadStderr -->
<!-- $$$readyReadStdout[overload1]$$$readyReadStdout -->
<h3 class="fn"><a name="readyReadStdout"></a><span class="type">void</span> Q3Process::<span class="name">readyReadStdout</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted when the process has written data to standard output. You can read the data with <a href="q3process.html#readStdout">readStdout</a>().</p>
<p>Note that this signal is only emitted when there is new data and not when there is old, but unread data. In the slot connected to this signal, you should always read everything that is available at that moment to make sure that you don't lose any data.</p>
<p><b>See also </b><a href="q3process.html#readStdout">readStdout</a>(), <a href="q3process.html#readLineStdout">readLineStdout</a>(), and <a href="q3process.html#readyReadStderr">readyReadStderr</a>().</p>
<!-- @@@readyReadStdout -->
<!-- $$$setArguments[overload1]$$$setArgumentsconstQStringList& -->
<h3 class="fn"><a name="setArguments"></a><span class="type">void</span> Q3Process::<span class="name">setArguments</span> ( const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp; <i>args</i> )<tt> [virtual]</tt></h3>
<p>Sets <i>args</i> as the arguments for the process. The first element in the list is the command to be executed. The other elements in the list are the arguments to the command. Any previous arguments are deleted.</p>
<p><a href="q3process.html" class="compat">Q3Process</a> does not perform argument substitutions; for example, if you specify &quot;*&quot; or &quot;$DISPLAY&quot;, these values are passed to the process literally. If you want to have the same behavior as the shell provides, you must do the substitutions yourself; i.e&#x2e; instead of specifying a &quot;*&quot; you must specify the list of all the filenames in the current directory, and instead of &quot;$DISPLAY&quot; you must specify the value of the environment variable <tt>DISPLAY</tt>.</p>
<p>Note for Windows users. The standard Windows shells, e.g&#x2e; <tt>command.com</tt> and <tt>cmd.exe</tt>, do not perform file globbing, i.e&#x2e; they do not convert a &quot;*&quot; on the command line into a list of files in the current directory. For this reason most Windows applications implement their own file globbing, and as a result of this, specifying an argument of &quot;*&quot; for a Windows application is likely to result in the application performing a file glob and ending up with a list of filenames.</p>
<p><b>See also </b><a href="q3process.html#arguments">arguments</a>() and <a href="q3process.html#addArgument">addArgument</a>().</p>
<!-- @@@setArguments -->
<!-- $$$setCommunication[overload1]$$$setCommunicationint -->
<h3 class="fn"><a name="setCommunication"></a><span class="type">void</span> Q3Process::<span class="name">setCommunication</span> ( <span class="type">int</span> <i>commFlags</i> )</h3>
<p>Sets <i>commFlags</i> as the communication required with the process.</p>
<p><i>commFlags</i> is a bitwise OR of the flags defined by the <tt>Communication</tt> enum.</p>
<p>The default is <tt>Stdin|Stdout|Stderr</tt>.</p>
<p><b>See also </b><a href="q3process.html#communication">communication</a>().</p>
<!-- @@@setCommunication -->
<!-- $$$setWorkingDirectory[overload1]$$$setWorkingDirectoryconstQDir& -->
<h3 class="fn"><a name="setWorkingDirectory"></a><span class="type">void</span> Q3Process::<span class="name">setWorkingDirectory</span> ( const <span class="type"><a href="qdir.html">QDir</a></span> &amp; <i>dir</i> )<tt> [virtual]</tt></h3>
<p>Sets <i>dir</i> as the working directory for processes. This does not affect running processes; only processes that are started afterwards are affected.</p>
<p>Setting the working directory is especially useful for processes that try to access files with relative paths.</p>
<p><b>See also </b><a href="q3process.html#workingDirectory">workingDirectory</a>() and <a href="q3process.html#start">start</a>().</p>
<!-- @@@setWorkingDirectory -->
<!-- $$$start[overload1]$$$startQStringList* -->
<h3 class="fn"><a name="start"></a><span class="type">bool</span> Q3Process::<span class="name">start</span> ( <span class="type"><a href="qstringlist.html">QStringList</a></span> * <i>env</i> = 0 )<tt> [virtual]</tt></h3>
<p>Tries to run a process for the command and arguments that were specified with <a href="q3process.html#setArguments">setArguments</a>(), <a href="q3process.html#addArgument">addArgument</a>() or that were specified in the constructor. The command is searched for in the path for executable programs; you can also use an absolute path in the command itself.</p>
<p>If <i>env</i> is null, then the process is started with the same environment as the starting process. If <i>env</i> is non-null, then the values in the stringlist are interpreted as environment setttings of the form <tt>key=value</tt> and the process is started in these environment settings. For convenience, there is a small exception to this rule: under Unix, if <i>env</i> does not contain any settings for the environment variable <tt>LD_LIBRARY_PATH</tt>, then this variable is inherited from the starting process; under Windows the same applies for the environment variable <tt>PATH</tt>.</p>
<p>Returns true if the process could be started; otherwise returns false.</p>
<p>You can write data to the process's standard input with <a href="q3process.html#writeToStdin">writeToStdin</a>(). You can close standard input with <a href="q3process.html#closeStdin">closeStdin</a>() and you can terminate the process with <a href="q3process.html#tryTerminate">tryTerminate</a>(), or with <a href="q3process.html#kill">kill</a>().</p>
<p>You can call this function even if you've used this instance to create a another process which is still running. In such cases, <a href="q3process.html" class="compat">Q3Process</a> closes the old process's standard input and deletes pending data, i.e&#x2e;, you lose all control over the old process, but the old process is not terminated. This applies also if the process could not be started. (On operating systems that have zombie processes, Qt will also wait() on the old process.)</p>
<p><b>See also </b><a href="q3process.html#launch">launch</a>() and <a href="q3process.html#closeStdin">closeStdin</a>().</p>
<!-- @@@start -->
<!-- $$$tryTerminate[overload1]$$$tryTerminate -->
<h3 class="fn"><a name="tryTerminate"></a><span class="type">void</span> Q3Process::<span class="name">tryTerminate</span> () const<tt> [slot]</tt></h3>
<p>Asks the process to terminate. Processes can ignore this if they wish. If you want to be certain that the process really terminates, you can use <a href="q3process.html#kill">kill</a>() instead.</p>
<p>The slot returns immediately: it does not wait until the process has finished. When the process terminates, the <a href="q3process.html#processExited">processExited</a>() signal is emitted.</p>
<p><b>See also </b><a href="q3process.html#kill">kill</a>() and <a href="q3process.html#processExited">processExited</a>().</p>
<!-- @@@tryTerminate -->
<!-- $$$workingDirectory[overload1]$$$workingDirectory -->
<h3 class="fn"><a name="workingDirectory"></a><span class="type"><a href="qdir.html">QDir</a></span> Q3Process::<span class="name">workingDirectory</span> () const</h3>
<p>Returns the working directory that was set with <a href="q3process.html#setWorkingDirectory">setWorkingDirectory</a>(), or the current directory if none has been explicitly set.</p>
<p><b>See also </b><a href="q3process.html#setWorkingDirectory">setWorkingDirectory</a>() and <a href="qdir.html#current">QDir::current</a>().</p>
<!-- @@@workingDirectory -->
<!-- $$$writeToStdin[overload1]$$$writeToStdinconstQByteArray& -->
<h3 class="fn"><a name="writeToStdin"></a><span class="type">void</span> Q3Process::<span class="name">writeToStdin</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> &amp; <i>buf</i> )<tt> [virtual slot]</tt></h3>
<p>Writes the data <i>buf</i> to the process's standard input. The process may or may not read this data.</p>
<p>This function returns immediately; the <a href="q3process.html" class="compat">Q3Process</a> class might write the data at a later point (you must enter the event loop for this to occur). When all the data is written to the process, the signal <a href="q3process.html#wroteToStdin">wroteToStdin</a>() is emitted. This does not mean that the process actually read the data, since this class only detects when it was able to write the data to the operating system.</p>
<p><b>See also </b><a href="q3process.html#wroteToStdin">wroteToStdin</a>(), <a href="q3process.html#closeStdin">closeStdin</a>(), <a href="q3process.html#readStdout">readStdout</a>(), and <a href="q3process.html#readStderr">readStderr</a>().</p>
<!-- @@@writeToStdin -->
<!-- $$$writeToStdin$$$writeToStdinconstQString& -->
<h3 class="fn"><a name="writeToStdin-2"></a><span class="type">void</span> Q3Process::<span class="name">writeToStdin</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>buf</i> )<tt> [virtual slot]</tt></h3>
<p>This is an overloaded function.</p>
<p>The string <i>buf</i> is handled as text using the <a href="qstring-qt3.html#local8Bit" class="compat">QString::local8Bit</a>() representation.</p>
<!-- @@@writeToStdin -->
<!-- $$$wroteToStdin[overload1]$$$wroteToStdin -->
<h3 class="fn"><a name="wroteToStdin"></a><span class="type">void</span> Q3Process::<span class="name">wroteToStdin</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted if the data sent to standard input (via <a href="q3process.html#writeToStdin">writeToStdin</a>()) was actually written to the process. This does not imply that the process really read the data, since this class only detects when it was able to write the data to the operating system. But it is now safe to close standard input without losing pending data.</p>
<p><b>See also </b><a href="q3process.html#writeToStdin">writeToStdin</a>() and <a href="q3process.html#closeStdin">closeStdin</a>().</p>
<!-- @@@wroteToStdin -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      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.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>