<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[SOLVED] Can&#96;t send data to QProcess]]></title><description><![CDATA[<p dir="auto">I<code>m trying to create an app, which can compile and run some simple cpp progs, so I need to write an output to textEdit and read input from lineEdit. The code below compiles, but the data isn</code>t sending to the process corectly (nothing happends).<br />
<a class="plugin-mentions-user plugin-mentions-a" href="/user/void">@<bdi>void</bdi></a> MainWindow::on_lineEdit_returnPressed()// input from lineEdit<br />
{<br />
ui-&gt;textEdit-&gt;insertPlainText(ui-&gt;lineEdit-&gt;text()+"\n");<br />
cp-&gt;write(ui-&gt;lineEdit-&gt;text().toStdString().c_str());<br />
ui-&gt;lineEdit-&gt;clear();<br />
}<br />
void MainWindow::on_action_24_triggered()<br />
{<br />
// The code below compiles and runs the prog from textEdit<br />
QString str = tabs[cur_tab]-&gt;toPlainText();<br />
QFile("temp.cpp").remove();<br />
QFile file("temp.cpp");<br />
file.open(QIODevice::Append | QIODevice::Text);<br />
QTextStream out(&amp;file);<br />
out &lt;&lt; str;<br />
out &lt;&lt; "\n";<br />
file.close();<br />
cp-&gt;start(("g++ temp.cpp"));<br />
cp-&gt;waitForFinished();<br />
if (!QFile::exists("a.exe"))<br />
{<br />
qDebug() &lt;&lt; "Error";<br />
ui-&gt;textEdit-&gt;append(cpError);<br />
}<br />
else<br />
{<br />
cp-&gt;start("a.exe");<br />
//Another trouble here<br />
//cp-&gt;waitForFinished(); //&lt;-If not commented then the programm crashes<br />
//QFile("a.exe").remove(); // And the file can<code>t be removed, because is still running     } }@ The main problem is that the data can</code>t reach the process, I don<code>t know why. There</code>re no warns or errors that are displayed.<br />
P.S. Sorry for my english!<a href="http://postimage.org/image/4sk3ru0wh/" target="_blank" rel="noopener noreferrer nofollow ugc">http://postimage.org/image/4sk3ru0wh/</a>(Screenshot of my UI)!</p>
]]></description><link>https://forum.qt.io/topic/24713/solved-can-t-send-data-to-qprocess</link><generator>RSS for Node</generator><lastBuildDate>Thu, 07 May 2026 13:01:34 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/24713.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Feb 2013 16:18:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [SOLVED] Can&#96;t send data to QProcess on Fri, 01 Mar 2013 11:13:37 GMT]]></title><description><![CDATA[<p dir="auto">The problem has been solved - you need to send "\n" at the end of input.</p>
]]></description><link>https://forum.qt.io/post/168866</link><guid isPermaLink="true">https://forum.qt.io/post/168866</guid><dc:creator><![CDATA[MiloserdOFF]]></dc:creator><pubDate>Fri, 01 Mar 2013 11:13:37 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] Can&#96;t send data to QProcess on Fri, 01 Mar 2013 03:31:52 GMT]]></title><description><![CDATA[<p dir="auto">Though not look into it, I think you may want to try QProcess::readAllStandardOutput() or QProcess::readAllStandardError() for details.</p>
]]></description><link>https://forum.qt.io/post/168807</link><guid isPermaLink="true">https://forum.qt.io/post/168807</guid><dc:creator><![CDATA[liuyanghejerry]]></dc:creator><pubDate>Fri, 01 Mar 2013 03:31:52 GMT</pubDate></item></channel></rss>