<?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[Editierbare Ausgabe]]></title><description><![CDATA[<p>hi,<br />
kaum angemeldet will ich gleich mal los fragen.<br />
und zwar würde ich gerne was ausgeben was editierbar ist und mit enter wie gewohnt an cin übergeben wird. quasi</p>
<pre><code class="language-cpp">std::string test;
&quot;ich bin editierbar&quot;&quot; &gt;&gt; std::cin &gt;&gt; test;
</code></pre>
<p>bin nach tagelanger suche echt verzweifelt. das kann doch kein problem sein was selten anzutreffen ist.</p>
<p>bin für jede hilfe dankbar <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>gruß postal</p>
<p>edit: ok also es soll in der konsole (hier bash) ein text ausgegeben werden (wie es z.b. cout macht) der aber änderbar ist, nicht wie im normalfall einfach da steht und mit backspace. wenn ich bei cin was eingebe kann ich es ja auch wieder löschen und buchstabendreher z.b. vertauschen.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

int main() {
	std::string editable;
	std::cout &lt;&lt; &quot;ich will editierbar sein&quot; &lt;&lt; std::endl;
	std::cin &gt;&gt; editable;
}
</code></pre>
<p>mein wunschablauf ist:<br />
./a.out (also starten)<br />
&quot;ich will editierbar sein&quot; wird angezeigt<br />
haue ich nun auf die tasten (sagen wir ich drücke 5 mal backspace,2 mal k und anschließen enter) sollte da stehen:<br />
&quot;ich will editierbarkk&quot;</p>
<p>nun sollte in editable &quot;ich will editierbarkk&quot; stehen.<br />
da &quot;ich will editierbar sein&quot; aber statisch ist kann man das so nicht realisieren. ich hoffe die erklärung ist besser <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/231542/editierbare-ausgabe</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 20:26:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/231542.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Jan 2009 12:53:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Editierbare Ausgabe on Mon, 12 Jan 2009 13:21:21 GMT]]></title><description><![CDATA[<p>hi,<br />
kaum angemeldet will ich gleich mal los fragen.<br />
und zwar würde ich gerne was ausgeben was editierbar ist und mit enter wie gewohnt an cin übergeben wird. quasi</p>
<pre><code class="language-cpp">std::string test;
&quot;ich bin editierbar&quot;&quot; &gt;&gt; std::cin &gt;&gt; test;
</code></pre>
<p>bin nach tagelanger suche echt verzweifelt. das kann doch kein problem sein was selten anzutreffen ist.</p>
<p>bin für jede hilfe dankbar <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>gruß postal</p>
<p>edit: ok also es soll in der konsole (hier bash) ein text ausgegeben werden (wie es z.b. cout macht) der aber änderbar ist, nicht wie im normalfall einfach da steht und mit backspace. wenn ich bei cin was eingebe kann ich es ja auch wieder löschen und buchstabendreher z.b. vertauschen.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

int main() {
	std::string editable;
	std::cout &lt;&lt; &quot;ich will editierbar sein&quot; &lt;&lt; std::endl;
	std::cin &gt;&gt; editable;
}
</code></pre>
<p>mein wunschablauf ist:<br />
./a.out (also starten)<br />
&quot;ich will editierbar sein&quot; wird angezeigt<br />
haue ich nun auf die tasten (sagen wir ich drücke 5 mal backspace,2 mal k und anschließen enter) sollte da stehen:<br />
&quot;ich will editierbarkk&quot;</p>
<p>nun sollte in editable &quot;ich will editierbarkk&quot; stehen.<br />
da &quot;ich will editierbar sein&quot; aber statisch ist kann man das so nicht realisieren. ich hoffe die erklärung ist besser <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1643850</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1643850</guid><dc:creator><![CDATA[postal]]></dc:creator><pubDate>Mon, 12 Jan 2009 13:21:21 GMT</pubDate></item><item><title><![CDATA[Reply to Editierbare Ausgabe on Mon, 12 Jan 2009 13:00:46 GMT]]></title><description><![CDATA[<p>Ich bin nicht ganz sicher, was du willst, aber da könntest du ja eine normale Abfrage rein tun.</p>
<pre><code class="language-cpp">if ( editierbar )
 std::cin &gt;&gt; test;
...
</code></pre>
<p>Wenn es nicht das ist, musst du ein wenig besser erklären, was du willst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1643852</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1643852</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Mon, 12 Jan 2009 13:00:46 GMT</pubDate></item><item><title><![CDATA[Reply to Editierbare Ausgabe on Mon, 12 Jan 2009 13:05:17 GMT]]></title><description><![CDATA[<p>das wird so einfach nicht möglich sein...</p>
<p>Wenn ich das richtig verstehe, willst du dem User einen Standardeintrag bieten, den er mit Enter bestätigen oder vorher noch abändern kann, sofern er das will...</p>
<p>In der Regel wird das so gelöst:</p>
<pre><code class="language-cpp">std::string test;
std::cout &lt;&lt; &quot;Gib was ein (Standardeingabe):&quot;;
std::cin &gt;&gt; test;

if ( test.isEmpty() )
{
    test = &quot;Standardeingabe&quot;;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1643854</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1643854</guid><dc:creator><![CDATA[zwutz]]></dc:creator><pubDate>Mon, 12 Jan 2009 13:05:17 GMT</pubDate></item><item><title><![CDATA[Reply to Editierbare Ausgabe on Mon, 12 Jan 2009 13:18:11 GMT]]></title><description><![CDATA[<p>zwutz schrieb:</p>
<blockquote>
<pre><code class="language-cpp">test.isEmpty()

}
</code></pre>
</blockquote>
<p>wxStrings? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>so würde ich es wirklich nur sehr sehr ungerne lösen aber da hab ich noch gar nicht dran gedacht. werde ich mir auf jedenfall im hinterkopf behalten wenn niemand einen anderen weg findet. danke für den tipp.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1643866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1643866</guid><dc:creator><![CDATA[postal]]></dc:creator><pubDate>Mon, 12 Jan 2009 13:18:11 GMT</pubDate></item><item><title><![CDATA[Reply to Editierbare Ausgabe on Mon, 12 Jan 2009 14:00:33 GMT]]></title><description><![CDATA[<p>postal schrieb:</p>
<blockquote>
<p>zwutz schrieb:</p>
<blockquote>
<pre><code class="language-cpp">test.isEmpty()

}
</code></pre>
</blockquote>
<p>wxStrings? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
</blockquote>
<p>ach stimmt... beim Standard-String heißt das nur <code>.empty()</code></p>
<p>kommt davon, wenn man die Nomenklatur eines Frameworks gewohnt ist (nein, nicht wxWidget) ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1643922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1643922</guid><dc:creator><![CDATA[zwutz]]></dc:creator><pubDate>Mon, 12 Jan 2009 14:00:33 GMT</pubDate></item></channel></rss>