<?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[wird sprintf(...) noch genutzt?]]></title><description><![CDATA[<p>HALLO.</p>
<p>noch eine weitere anfängerfrage zu folgendem funktionierenden code:</p>
<pre><code class="language-cpp">#include &lt;conio.h&gt;
#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include &lt;fstream&gt;
#include &lt;sstream&gt;

using namespace std;

int main()
{
	double a;
	std::stringstream filename;
	char buf[30];

        a = sqrt(4.0);
	filename &lt;&lt; &quot;datei&quot; &lt;&lt; a &lt;&lt; &quot;.txt&quot;;
	sprintf(buf, filename.str().c_str());
	std::ofstream myfile( buf, std::ios_base::out | std::ios_base::app );
	myfile.close();

    return 0;
}
</code></pre>
<p>mein compiler gibt mir hier eine warnung, das sprintf schon veraltet ist. wie macht man den das dann &quot;heutzutage&quot;?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/151327/wird-sprintf-noch-genutzt</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 08:48:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/151327.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 25 Jun 2006 10:51:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to wird sprintf(...) noch genutzt? on Sun, 25 Jun 2006 10:51:39 GMT]]></title><description><![CDATA[<p>HALLO.</p>
<p>noch eine weitere anfängerfrage zu folgendem funktionierenden code:</p>
<pre><code class="language-cpp">#include &lt;conio.h&gt;
#include &lt;iostream&gt;
#include &lt;cmath&gt;
#include &lt;fstream&gt;
#include &lt;sstream&gt;

using namespace std;

int main()
{
	double a;
	std::stringstream filename;
	char buf[30];

        a = sqrt(4.0);
	filename &lt;&lt; &quot;datei&quot; &lt;&lt; a &lt;&lt; &quot;.txt&quot;;
	sprintf(buf, filename.str().c_str());
	std::ofstream myfile( buf, std::ios_base::out | std::ios_base::app );
	myfile.close();

    return 0;
}
</code></pre>
<p>mein compiler gibt mir hier eine warnung, das sprintf schon veraltet ist. wie macht man den das dann &quot;heutzutage&quot;?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084993</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084993</guid><dc:creator><![CDATA[Hans Wurst]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:51:39 GMT</pubDate></item><item><title><![CDATA[Reply to wird sprintf(...) noch genutzt? on Sun, 25 Jun 2006 10:55:11 GMT]]></title><description><![CDATA[<p>Du kannst filename.str().c_str() direkt an den ofstream Konstruktor geben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084995</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084995</guid><dc:creator><![CDATA[...........]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:55:11 GMT</pubDate></item><item><title><![CDATA[Reply to wird sprintf(...) noch genutzt? on Sun, 25 Jun 2006 10:57:42 GMT]]></title><description><![CDATA[<p>cool!<br />
vielen dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1084997</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1084997</guid><dc:creator><![CDATA[Hans_Wurst]]></dc:creator><pubDate>Sun, 25 Jun 2006 10:57:42 GMT</pubDate></item></channel></rss>