<?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[float wert in .txt schrieben]]></title><description><![CDATA[<p>Guten Tag liebe comunity <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="🙂"
    /><br />
ich habe eine frage, und zwa :<br />
wie kann ich einen float wert in einer txtdati speichen ?<br />
also fill hilft das zur lösung bei,:<br />
so bin ich auf den wert gekomen:</p>
<pre><code class="language-cpp">float posiX;
posiX = *(float*)(dld + cal);
</code></pre>
<p>so also wollte jetzt posiX in einer .txt speichern, wie mach ich das ?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/271910/float-wert-in-txt-schrieben</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 03:28:21 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/271910.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 06 Aug 2010 01:39:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to float wert in .txt schrieben on Fri, 06 Aug 2010 01:39:11 GMT]]></title><description><![CDATA[<p>Guten Tag liebe comunity <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="🙂"
    /><br />
ich habe eine frage, und zwa :<br />
wie kann ich einen float wert in einer txtdati speichen ?<br />
also fill hilft das zur lösung bei,:<br />
so bin ich auf den wert gekomen:</p>
<pre><code class="language-cpp">float posiX;
posiX = *(float*)(dld + cal);
</code></pre>
<p>so also wollte jetzt posiX in einer .txt speichern, wie mach ich das ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1936864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1936864</guid><dc:creator><![CDATA[cracy112]]></dc:creator><pubDate>Fri, 06 Aug 2010 01:39:11 GMT</pubDate></item><item><title><![CDATA[Reply to float wert in .txt schrieben on Fri, 06 Aug 2010 01:52:25 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">float value = ...;

std::ostream stream(&quot;file.txt&quot;);
stream &lt;&lt; value;
</code></pre>
<p>doku: <a href="http://www.cplusplus.com/reference/" rel="nofollow">http://www.cplusplus.com/reference/</a></p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1936868</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1936868</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Fri, 06 Aug 2010 01:52:25 GMT</pubDate></item><item><title><![CDATA[Reply to float wert in .txt schrieben on Fri, 06 Aug 2010 07:27:25 GMT]]></title><description><![CDATA[<p>unskilled schrieb:</p>
<blockquote>
<pre><code class="language-cpp">float value = ...;

std::ostream stream(&quot;file.txt&quot;);
stream &lt;&lt; value;
</code></pre>
</blockquote>
<p>.. im besten Fall wird das abstürzen; besser:</p>
<pre><code class="language-cpp">float posiX = ...;
    std::ofstream stream(&quot;file.txt&quot;);
    stream &lt;&lt; posiX;
</code></pre>
<p>'std::ofstream' macht ein '#include &lt;fstream&gt;' erforderlich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1936911</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1936911</guid><dc:creator><![CDATA[Werner_logoff]]></dc:creator><pubDate>Fri, 06 Aug 2010 07:27:25 GMT</pubDate></item><item><title><![CDATA[Reply to float wert in .txt schrieben on Fri, 06 Aug 2010 16:52:05 GMT]]></title><description><![CDATA[<p>Werner_logoff schrieb:</p>
<blockquote>
<p>unskilled schrieb:</p>
<blockquote>
<pre><code class="language-cpp">float value = ...;

std::ostream stream(&quot;file.txt&quot;);
stream &lt;&lt; value;
</code></pre>
</blockquote>
<p>.. im besten Fall wird das abstürzen; besser:</p>
<pre><code class="language-cpp">float posiX = ...;
    std::ofstream stream(&quot;file.txt&quot;);
    stream &lt;&lt; posiX;
</code></pre>
<p>'std::ofstream' macht ein '#include &lt;fstream&gt;' erforderlich.</p>
</blockquote>
<p>ok das funzt schonmal, nur die textdatei wird ja dann in der dll gespeichert.<br />
wie bekomme ich die dan auf den desktop, bzw dahin wo die dll auch ist ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1937195</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1937195</guid><dc:creator><![CDATA[cracy112]]></dc:creator><pubDate>Fri, 06 Aug 2010 16:52:05 GMT</pubDate></item><item><title><![CDATA[Reply to float wert in .txt schrieben on Fri, 06 Aug 2010 16:59:56 GMT]]></title><description><![CDATA[<p>Werner_logoff schrieb:</p>
<blockquote>
<p>unskilled schrieb:</p>
<blockquote>
<pre><code class="language-cpp">float value = ...;

std::ostream stream(&quot;file.txt&quot;);
stream &lt;&lt; value;
</code></pre>
</blockquote>
<p>.. im besten Fall wird das abstürzen; besser:</p>
<pre><code class="language-cpp">float posiX = ...;
    std::ofstream stream(&quot;file.txt&quot;);
    stream &lt;&lt; posiX;
</code></pre>
<p>'std::ofstream' macht ein '#include &lt;fstream&gt;' erforderlich.</p>
</blockquote>
<p>japp, sry<br />
hab ich das f vergessen - hab ich aber auch erst nachm 20. mal lesen gesehen : D<br />
danke</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1937201</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1937201</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Fri, 06 Aug 2010 16:59:56 GMT</pubDate></item><item><title><![CDATA[Reply to float wert in .txt schrieben on Fri, 06 Aug 2010 20:18:47 GMT]]></title><description><![CDATA[<blockquote>
<p>k das funzt schonmal, nur die textdatei wird ja dann in der dll gespeichert.<br />
wie bekomme ich die dan auf den desktop, bzw dahin wo die dll auch ist ?</p>
</blockquote>
<p>In der DLL gespeichert ??</p>
<pre><code class="language-cpp">float posiX = ...;
std::ofstream stream(&quot;C:\\Dokumente und Einstellungen\\...\\Desktop\\file.txt&quot;);
stream &lt;&lt; posiX;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1937276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1937276</guid><dc:creator><![CDATA[DarkShadow44]]></dc:creator><pubDate>Fri, 06 Aug 2010 20:18:47 GMT</pubDate></item><item><title><![CDATA[Reply to float wert in .txt schrieben on Fri, 06 Aug 2010 20:52:40 GMT]]></title><description><![CDATA[<p>Der Desktop-Pfad ist je nach User, Windows-Version und ggf. Umleitung unterschiedlich, also macht es wenig Sinn, ihn fest zu verdrahten. Besser:</p>
<pre><code class="language-cpp">#include &lt;fstream&gt;
#include &lt;string&gt;
#include &lt;Shlobj.h&gt;

int main() {
  char desktop_path[MAX_PATH];

  if(S_OK != SHGetFolderPathA(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT, desktop_path)) {
    return -1;
  }

  std::ofstream file((std::string(desktop_path) + &quot;\\file.txt&quot;).c_str());

  file &lt;&lt; &quot;Hallo, Welt!&quot; &lt;&lt; std::endl;
}
</code></pre>
<p>Unter Linux sollte in aller Regel</p>
<pre><code class="language-cpp">std::ofstream file(&quot;~/Desktop/file.txt&quot;);
</code></pre>
<p>funktionieren; ich weiß aber nicht, ob das irgendwo tatsächlich standardisiert ist.</p>
<p>Allerdings ist es regelmäßig schlechter Stil, Dateien fest verdrahtet ins Desktop-Verzeichnis zu schreiben, denn der Desktop wird damit schnell überfüllt. Meistens ist es besser, Ausgabedateien im Arbeitsverzeichnis zu erzeugen - man kann es, wenn man denn wirklich will, immer noch in einer .lnk-Datei o.ä. auf das Desktopverzeichnis setzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1937291</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1937291</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Fri, 06 Aug 2010 20:52:40 GMT</pubDate></item></channel></rss>