<?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[string als Rückgabewert]]></title><description><![CDATA[<p>Hi, ich hab eine Funktion die einen string zurückgeben soll.</p>
<p>Die Funktion einfach</p>
<pre><code class="language-cpp">string Funktion(..)
{

return (string)
}
</code></pre>
<p>funktioniert nicht. Bekomme da die Fehlermeldung : conversion from 'void' to non-scalar type 'std::string' requested.</p>
<p>Weiss jemand wie man das löst ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/209324/string-als-rückgabewert</link><generator>RSS for Node</generator><lastBuildDate>Mon, 12 Oct 2026 14:42:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/209324.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 29 Mar 2008 10:57:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 10:57:02 GMT]]></title><description><![CDATA[<p>Hi, ich hab eine Funktion die einen string zurückgeben soll.</p>
<p>Die Funktion einfach</p>
<pre><code class="language-cpp">string Funktion(..)
{

return (string)
}
</code></pre>
<p>funktioniert nicht. Bekomme da die Fehlermeldung : conversion from 'void' to non-scalar type 'std::string' requested.</p>
<p>Weiss jemand wie man das löst ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1482578</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482578</guid><dc:creator><![CDATA[toxor]]></dc:creator><pubDate>Sat, 29 Mar 2008 10:57:02 GMT</pubDate></item><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 11:10:12 GMT]]></title><description><![CDATA[<p>Ist das jetzt pseudo code?</p>
<pre><code class="language-cpp">return (string)
</code></pre>
<p>muss natuerlich wirklich einen String zurueckliefern:</p>
<pre><code class="language-cpp">return string(&quot;bla&quot;)
</code></pre>
<p>Ansonsten zeig mal mehr code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1482583</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482583</guid><dc:creator><![CDATA[DeSoVoDaMu]]></dc:creator><pubDate>Sat, 29 Mar 2008 11:10:12 GMT</pubDate></item><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 11:16:29 GMT]]></title><description><![CDATA[<p>Also normalerweise müsste das funktionieren ?</p>
<p>Zum Code : Ich will hier den Platzhalter (PH_23) berechnen.</p>
<pre><code class="language-cpp">string AbstandFunc_Name(string Name)
{
	string PH_23 = &quot;                       &quot;;
	string PH_Name; 

	int x;
	PH_Name = PH_23;
	int i = Name.length();
	x=24-i;
	return (PH_Name.resize(x));

}
</code></pre>
<p>EDIT:<br />
Ahh ok thx,</p>
<pre><code class="language-cpp">string AbstandFunc_Name(string Name)
{
	string PH_23 = &quot;                       &quot;;
	string PH_Name; 

	int x;
	PH_Name = PH_23;
	int i = Name.length();
	x=24-i;
        PH_Name.resize(x);
        return (PH_Name);

}
</code></pre>
<p>so gehts <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/1482586</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482586</guid><dc:creator><![CDATA[toxor]]></dc:creator><pubDate>Sat, 29 Mar 2008 11:16:29 GMT</pubDate></item><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 11:19:06 GMT]]></title><description><![CDATA[<p>das geht auch etwas kürzer <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>
<pre><code class="language-cpp">std::string platzhalter(std::sting const &amp; other)
{
  size_t len = std::max(24-other.length(), 0)
  return std::string(len, ' ');
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1482589</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482589</guid><dc:creator><![CDATA[ronny]]></dc:creator><pubDate>Sat, 29 Mar 2008 11:19:06 GMT</pubDate></item><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 11:31:29 GMT]]></title><description><![CDATA[<p>Ja ich bin noch nicht so der Checker und schreibe teils sehr eigenartige Konstruktionen, das geb ich schon zu :D. Aber ich bin halt froh wenn es erstmal funktioniert, optimieren tu ich erst später :).</p>
<p>Ich bekomm bei dir nen Fehler : no matching function for call to 'max(unsigned int,int)'.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1482593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482593</guid><dc:creator><![CDATA[toxor]]></dc:creator><pubDate>Sat, 29 Mar 2008 11:31:29 GMT</pubDate></item><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 11:35:25 GMT]]></title><description><![CDATA[<p>&lt;algorithm&gt;</p>
<p>und keinen veralteten Compiler oder ein M$-Produkt nutzen...</p>
<p><a href="http://www.devx.com/tips/Tip/14540" rel="nofollow">http://www.devx.com/tips/Tip/14540</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1482597</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482597</guid><dc:creator><![CDATA[langeweile]]></dc:creator><pubDate>Sat, 29 Mar 2008 11:35:25 GMT</pubDate></item><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 12:02:41 GMT]]></title><description><![CDATA[<p>Hmmm ich benutze den Compiler von Dev-cpp ,soweit ich weiss ist der weder veraltet noch schlecht, oder bin ich falsch informiert ?<br />
Funktioniert leider auch nicht wenn ich &lt;algorithm&gt; includiere.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1482607</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482607</guid><dc:creator><![CDATA[toxor]]></dc:creator><pubDate>Sat, 29 Mar 2008 12:02:41 GMT</pubDate></item><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 14:39:14 GMT]]></title><description><![CDATA[<p>Was kommt denn für eine Fehlermeldung? (ich hoffe, mal du hast den Schreibfehler std::st<strong>r</strong>ing beseitigt.)</p>
<p>P.S.<br />
Die Dev-C++ IDE ist veraltet (s. <a href="http://de.wikipedia.org/wiki/DevCpp" rel="nofollow">http://de.wikipedia.org/wiki/DevCpp</a>), benutzt lieber Code::Blocks (s. <a href="http://de.wikipedia.org/wiki/Code::Blocks" rel="nofollow">http://de.wikipedia.org/wiki/Code::Blocks</a>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1482691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482691</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Sat, 29 Mar 2008 14:39:14 GMT</pubDate></item><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 15:07:18 GMT]]></title><description><![CDATA[<p>ja klar den Scheibfehler hab ich raus gemacht, die Fehlermeldung ist genaugleich wie oben. Naja ok dann werd ich mal den Code::blocks testen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1482703</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482703</guid><dc:creator><![CDATA[toxor]]></dc:creator><pubDate>Sat, 29 Mar 2008 15:07:18 GMT</pubDate></item><item><title><![CDATA[Reply to string als Rückgabewert on Sat, 29 Mar 2008 15:15:06 GMT]]></title><description><![CDATA[<p>OK, dachte es wäre eine andere Fehlermeldung...</p>
<p>Probier mal:</p>
<pre><code class="language-cpp">size_t len = std::max(24-other.length(), 0u) // u bedeutet unsigned
</code></pre>
<p>P.S. Das Problem beim Dev-C++ ist nicht die IDE, sondern der veraltete Compiler (gcc 2.x), der dort verwendet wird.<br />
Somit ist es einfacher, die komplette IDE (+ Compiler) auszutauschen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1482704</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1482704</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Sat, 29 Mar 2008 15:15:06 GMT</pubDate></item></channel></rss>