⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qprocess.html

📁 qtopiaphone英文帮助,用于初学者和开发人员,初学者可以用来学习,开发人员可以用来资料查询.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<h3 class=fn>bool <a name="launch"></a>QProcess::launch ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;buf, QStringList&nbsp;*&nbsp;env = 0 )<tt> [virtual]</tt></h3>Runs the process and writes the data <em>buf</em> to the process's standard input.If all the data is written to standard input, standard input isclosed. The command is searched for in the path for executable programs;you can also use an absolute path in the command itself.<p> If <em>env</em> is null, then the process is started with the same environment asthe starting process. If <em>env</em> is non-null, then the values in thestringlist are interpreted as environment setttings of the form <tt>key=value</tt> and the process is started with these environment settings. Forconvenience, there is a small exception to this rule under Unix: if <em>env</em>does not contain any settings for the environment variable <tt>LD_LIBRARY_PATH</tt>, then this variable is inherited from the starting process.<p> Returns TRUE if the process could be started; otherwise returns FALSE.<p> Note that you should not use the slots <a href="#writeToStdin">writeToStdin</a>() and <a href="#closeStdin">closeStdin</a>() onprocesses started with <a href="#launch">launch</a>(), since the result is not well-defined. If youneed these slots, use <a href="#start">start</a>() instead.<p> The process may or may not read the <em>buf</em> data sent to its standardinput.<p> You can call this function even when a process that was started withthis instance is still running. Be aware that if you do this thestandard input of the process that was launched first will beclosed, with any pending data being deleted, and the process will beleft to run out of your control. Similarly, if the process could notbe started the standard input will be closed and the pending datadeleted. (On operating systems that have zombie processes, Qt willalso wait() on the old process.)<p> The object emits the signal <a href="#launchFinished">launchFinished</a>() when this functioncall is finished. If the start was successful, this signal isemitted after all the data has been written to standard input. Ifthe start failed, then this signal is emitted immediately.<p> <p>See also <a href="#start">start</a>() and <a href="#launchFinished">launchFinished</a>().<h3 class=fn>bool <a name="launch-2"></a>QProcess::launch ( const&nbsp;QString&nbsp;&amp;&nbsp;buf, QStringList&nbsp;*&nbsp;env = 0 )<tt> [virtual]</tt></h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.<p> The data <em>buf</em> is written to standard input with <a href="#writeToStdin">writeToStdin</a>()using the QString::local8Bit() representation of the strings.<h3 class=fn>void <a name="launchFinished"></a>QProcess::launchFinished ()<tt> [signal]</tt></h3><p> This signal is emitted when the process was started with <a href="#launch">launch</a>().If the start was successful, this signal is emitted after all thedata has been written to standard input. If the start failed, thenthis signal is emitted immediately.<p> <p>See also <a href="#launch">launch</a>() and QObject::deleteLater().<h3 class=fn>bool <a name="normalExit"></a>QProcess::normalExit () const</h3>Returns TRUE if the process has exited normally; otherwise returnsFALSE. This implies that this function returns FALSE if the processis still running.<p> <p>See also <a href="#isRunning">isRunning</a>(), <a href="#exitStatus">exitStatus</a>() and <a href="#processExited">processExited</a>().<h3 class=fn>void <a name="processExited"></a>QProcess::processExited ()<tt> [signal]</tt></h3><p> This signal is emitted when the process has exited.<p> <p>See also <a href="#isRunning">isRunning</a>(), <a href="#normalExit">normalExit</a>(), <a href="#exitStatus">exitStatus</a>(), <a href="#start">start</a>() and <a href="#launch">launch</a>().<h3 class=fn>PID <a name="processIdentifier"></a>QProcess::processIdentifier ()</h3>Returns platform dependent information about the process. This can be usedtogether with platform specific system calls.<p> Under Unix the return value is the PID of the process, or -1 if no process isbelonging to this object.<p> Under Windows it is a pointer to the <tt>PROCESS_INFORMATION</tt> struct, or 0 ifno process is belonging to this object.<h3 class=fn>QString <a name="readLineStderr"></a>QProcess::readLineStderr ()<tt> [virtual]</tt></h3>Reads a line of text from standard error, excluding any trailing newline orcarriage return characters and returns it. Returns QString::null if<a href="#canReadLineStderr">canReadLineStderr</a>() returns FALSE.<p> <p>See also <a href="#canReadLineStderr">canReadLineStderr</a>(), <a href="#readyReadStderr">readyReadStderr</a>(), <a href="#readStderr">readStderr</a>() and <a href="#readLineStdout">readLineStdout</a>().<h3 class=fn>QString <a name="readLineStdout"></a>QProcess::readLineStdout ()<tt> [virtual]</tt></h3>Reads a line of text from standard output, excluding any trailing newline orcarriage return characters, and returns it. Returns QString::null if<a href="#canReadLineStdout">canReadLineStdout</a>() returns FALSE.<p> <p>See also <a href="#canReadLineStdout">canReadLineStdout</a>(), <a href="#readyReadStdout">readyReadStdout</a>(), <a href="#readStdout">readStdout</a>() and <a href="#readLineStderr">readLineStderr</a>().<h3 class=fn>QByteArray <a name="readStderr"></a>QProcess::readStderr ()<tt> [virtual]</tt></h3>Reads the data that the process has written to standard error. Whennew data is written to standard error, the class emits the signal<a href="#readyReadStderr">readyReadStderr</a>().<p> If there is no data to read, this function returns a QByteArray ofsize 0: it does not wait until there is something to read.<p> <p>See also <a href="#readyReadStderr">readyReadStderr</a>(), <a href="#readLineStderr">readLineStderr</a>(), <a href="#readStdout">readStdout</a>() and <a href="#writeToStdin">writeToStdin</a>().<h3 class=fn>QByteArray <a name="readStdout"></a>QProcess::readStdout ()<tt> [virtual]</tt></h3>Reads the data that the process has written to standard output. Whennew data is written to standard output, the class emits the signal<a href="#readyReadStdout">readyReadStdout</a>().<p> If there is no data to read, this function returns a QByteArray ofsize 0: it does not wait until there is something to read.<p> <p>See also <a href="#readyReadStdout">readyReadStdout</a>(), <a href="#readLineStdout">readLineStdout</a>(), <a href="#readStderr">readStderr</a>() and <a href="#writeToStdin">writeToStdin</a>().<h3 class=fn>void <a name="readyReadStderr"></a>QProcess::readyReadStderr ()<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="#readStderr">readStderr</a>().<p> Note that this signal is only emitted when there is new data and notwhen there is old, but unread data. In the slot connected to this signal, youshould always read everything that is available at that moment to make surethat you don't lose any data.<p> <p>See also <a href="#readStderr">readStderr</a>(), <a href="#readLineStderr">readLineStderr</a>() and <a href="#readyReadStdout">readyReadStdout</a>().<h3 class=fn>void <a name="readyReadStdout"></a>QProcess::readyReadStdout ()<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="#readStdout">readStdout</a>().<p> Note that this signal is only emitted when there is new data and notwhen there is old, but unread data. In the slot connected to this signal, youshould always read everything that is available at that moment to make surethat you don't lose any data.<p> <p>See also <a href="#readStdout">readStdout</a>(), <a href="#readLineStdout">readLineStdout</a>() and <a href="#readyReadStderr">readyReadStderr</a>().<h3 class=fn>void <a name="setArguments"></a>QProcess::setArguments ( const&nbsp;QStringList&nbsp;&amp;&nbsp;args )<tt> [virtual]</tt></h3>Sets <em>args</em> as the arguments for the process. The first element in the listis the command to be executed. The other elements in the list are thearguments to the command. Any previous arguments are deleted.<p> <p>See also <a href="#arguments">arguments</a>() and <a href="#addArgument">addArgument</a>().<h3 class=fn>void <a name="setCommunication"></a>QProcess::setCommunication ( int&nbsp;commFlags )</h3>Sets <em>commFlags</em> as the communication required with the process.<p> <em>commFlags</em> is a bitwise OR between the flags defined in <a href="#Communication-enum">Communication</a>.<p> The default is <tt>Stdin|Stdout|Stderr</tt>.<p> <p>See also <a href="#communication">communication</a>().<h3 class=fn>void <a name="setPriority"></a>QProcess::setPriority ( int&nbsp;p )</h3>Sets the process priority to <em>p</em>, a value from -20 to 20,where 0 is normal, lower values a give more favourablepriority, larger values less favourable.<h3 class=fn>void <a name="setWorkingDirectory"></a>QProcess::setWorkingDirectory ( const&nbsp;QDir&nbsp;&amp;&nbsp;dir )<tt> [virtual]</tt></h3>Sets <em>dir</em> as the working directory for a process. This does not affectrunning processes; only processes that are started afterwards are affected.<p> Setting the working directory is especially useful for processes that try toaccess files with relative filenames.<p> <p>See also <a href="#workingDirectory">workingDirectory</a>() and <a href="#start">start</a>().<h3 class=fn>bool <a name="start"></a>QProcess::start ( QStringList&nbsp;*&nbsp;env = 0 )<tt> [virtual]</tt></h3>Tries to run a process for the command and arguments that were specified with<a href="#setArguments">setArguments</a>(), <a href="#addArgument">addArgument</a>() or that were specified in the constructor. Thecommand is searched in the path for executable programs; you can also use anabsolute path to the command.<p> If <em>env</em> is null, then the process is started with the same environment asthe starting process. If <em>env</em> is non-null, then the values in thestringlist are interpreted as environment setttings of the form <tt>key=value</tt> and the process is started in these environment settings. Forconvenience, there is a small exception to this rule: under Unix, if <em>env</em>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 enverionment varialbe <tt>PATH</tt>.<p> Returns TRUE if the process could be started, otherwise FALSE.<p> You can write data to standard input of the process with<a href="#writeToStdin">writeToStdin</a>(), you can close standard input with <a href="#closeStdin">closeStdin</a>() and you canterminate the process <a href="#tryTerminate">tryTerminate</a>() resp. <a href="#kill">kill</a>().<p> You can call this function even when there already is a runningprocess in this object. In this case, QProcess closes standard inputof the old process and deletes pending data, i.e., you loose allcontrol over that process, but the process is not terminated. This appliesalso if the process could not be started. (On operating systems that havezombie processes, Qt will also wait() on the old process.)<p> <p>See also <a href="#launch">launch</a>() and <a href="#closeStdin">closeStdin</a>().<h3 class=fn>void <a name="tryTerminate"></a>QProcess::tryTerminate () const<tt> [slot]</tt></h3>Asks the process to terminate. Processes can ignore this wish. If you want tobe sure that the process really terminates, you must use <a href="#kill">kill</a>() instead.<p> The slot returns immediately: it does not wait until the process hasfinished. When the process really exited, the signal <a href="#processExited">processExited</a>() isemitted.<p> <p>See also <a href="#kill">kill</a>() and <a href="#processExited">processExited</a>().<h3 class=fn>QDir <a name="workingDirectory"></a>QProcess::workingDirectory () const</h3>Returns the working directory that was set with<a href="#setWorkingDirectory">setWorkingDirectory</a>(), or the current directory if none has beenset.<p> <p>See also <a href="#setWorkingDirectory">setWorkingDirectory</a>().<h3 class=fn>void <a name="writeToStdin"></a>QProcess::writeToStdin ( const&nbsp;QByteArray&nbsp;&amp;&nbsp;buf )<tt> [virtual slot]</tt></h3>Writes the data <em>buf</em> to the standard input of the process. The process mayor may not read this data.<p> This function returns immediately; the QProcess class might write the data ata later point (you have to enter the event loop for that). When all the datais written to the process, the signal <a href="#wroteToStdin">wroteToStdin</a>() is emitted. This doesnot mean that the process really read the data, since this class only detectswhen it was able to write the data to the operating system.<p> <p>See also <a href="#wroteToStdin">wroteToStdin</a>(), <a href="#closeStdin">closeStdin</a>(), <a href="#readStdout">readStdout</a>() and <a href="#readStderr">readStderr</a>().<h3 class=fn>void <a name="writeToStdin-2"></a>QProcess::writeToStdin ( const&nbsp;QString&nbsp;&amp;&nbsp;buf )<tt> [virtual slot]</tt></h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.<p> The string <em>buf</em> is handled as text usingthe QString::local8Bit() representation.<h3 class=fn>void <a name="wroteToStdin"></a>QProcess::wroteToStdin ()<tt> [signal]</tt></h3><p> This signal is emitted if the data sent to standard input (via<a href="#writeToStdin">writeToStdin</a>()) was actually written to the process. This does notimply that the process really read the data, since this class only detectswhen it was able to write the data to the operating system. But it is nowsafe to close standard input without losing pending data.<p> <p>See also <a href="#writeToStdin">writeToStdin</a>() and <a href="#closeStdin">closeStdin</a>().<!-- eof --><hr><p>This file is part of the <a href="../index.html">Qtopia</a> platform,copyright &copy; 1995-2004<a href="http://www.trolltech.com/">Trolltech</a>, all rights reserved.<p><address><hr><div align="center"><table width="100%" cellspacing="0" border="0"><tr><td>Copyright &copy; 2001-2004 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align="right"><div align="right">Qtopia version 2.0.0</div></table></div></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -