<?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[speichern einer datei]]></title><description><![CDATA[<p>hi,<br />
ich hab folgendes problem:<br />
ich muss eine funktion schreiben welche dafür zuständig ist eine matrix in eine datei zu speichern...<br />
das speichern mach ich mit ostream is ja auch kein ding... nur muss ich jetzt noch angeben wie die datei heißen soll...<br />
wie kann ich das machen?</p>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/226598/speichern-einer-datei</link><generator>RSS for Node</generator><lastBuildDate>Wed, 30 Sep 2026 18:27:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/226598.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Nov 2008 14:16:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to speichern einer datei on Mon, 03 Nov 2008 14:16:09 GMT]]></title><description><![CDATA[<p>hi,<br />
ich hab folgendes problem:<br />
ich muss eine funktion schreiben welche dafür zuständig ist eine matrix in eine datei zu speichern...<br />
das speichern mach ich mit ostream is ja auch kein ding... nur muss ich jetzt noch angeben wie die datei heißen soll...<br />
wie kann ich das machen?</p>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1609459</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1609459</guid><dc:creator><![CDATA[manbearpig]]></dc:creator><pubDate>Mon, 03 Nov 2008 14:16:09 GMT</pubDate></item><item><title><![CDATA[Reply to speichern einer datei on Mon, 03 Nov 2008 14:18:41 GMT]]></title><description><![CDATA[<p>Mit std::cin den Dateinamen interaktiv Abfragen, oder als Kommandozeilenparameter über argc und argv.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1609464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1609464</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Mon, 03 Nov 2008 14:18:41 GMT</pubDate></item><item><title><![CDATA[Reply to speichern einer datei on Mon, 03 Nov 2008 14:21:52 GMT]]></title><description><![CDATA[<p>das hab ich gemacht... aba irgendwie muss die zu speichernde datei ein const char sein<br />
das bekomm ich irgendwie ned hin</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1609469</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1609469</guid><dc:creator><![CDATA[manbearpig]]></dc:creator><pubDate>Mon, 03 Nov 2008 14:21:52 GMT</pubDate></item><item><title><![CDATA[Reply to speichern einer datei on Mon, 03 Nov 2008 14:44:42 GMT]]></title><description><![CDATA[<p>Zeig mal, wie Du es versucht hast.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1609491</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1609491</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Mon, 03 Nov 2008 14:44:42 GMT</pubDate></item><item><title><![CDATA[Reply to speichern einer datei on Mon, 03 Nov 2008 14:57:52 GMT]]></title><description><![CDATA[<p>naja ich hab jetzt schon wie ein irrer rumproiert...sowas hab ich nun:</p>
<p>char name;<br />
cin &gt;&gt; name;<br />
const char *eingabe = name;<br />
ofstream datei(*eingabe);</p>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1609505</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1609505</guid><dc:creator><![CDATA[manbearpig]]></dc:creator><pubDate>Mon, 03 Nov 2008 14:57:52 GMT</pubDate></item><item><title><![CDATA[Reply to speichern einer datei on Mon, 03 Nov 2008 15:01:34 GMT]]></title><description><![CDATA[<p>Hm, vielleicht wäre ein Einsteigertutorial etwas für dich (nicht böse gemeint).</p>
<p>In C++ benutzt man generell den Datentyp <code>std::string</code> für Zeichenketten. Wenn man es schon C-mässig machen will, dann über <code>char*</code> und nicht <code>char</code> . Dann sollte man aber auch die Speicherverwaltung in die Hand nehmen.</p>
<pre><code class="language-cpp">std::string name;
std::cin &gt;&gt; name;
std::ofstream datei(name.c_str()); // c_str() gibt einen const char* zurück
</code></pre>
<p>Bitte in Zukunft auch [cpp]-Tags nutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1609510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1609510</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Mon, 03 Nov 2008 15:01:34 GMT</pubDate></item><item><title><![CDATA[Reply to speichern einer datei on Mon, 03 Nov 2008 15:04:11 GMT]]></title><description><![CDATA[<p>hey super danke!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1609513</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1609513</guid><dc:creator><![CDATA[manbearpig]]></dc:creator><pubDate>Mon, 03 Nov 2008 15:04:11 GMT</pubDate></item><item><title><![CDATA[Reply to speichern einer datei on Mon, 03 Nov 2008 15:16:08 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/12954">@Nexus</a>,<br />
Und wenn ich nun sowas eintippe?</p>
<pre><code>C:\Dokumente und Einstellungen\Maultier\Eigene Dateien\test.sav
</code></pre>
<p>Deshalb bei Pfadangaben und ähnlichem lieber <code>std::getline</code> verwenden:</p>
<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;fstream&gt;
#include &lt;iostream&gt;

int main()
{
  std::cout &lt;&lt; &quot;Enter path to file: &quot;;
  std::cout.flush();

  std::string path;
  std::getline(std::cin, path);

  std::ofstream file(path.c_str());

  // ...

  return 0;
}
</code></pre>
<p>C++ Referenz: <a href="http://www.cplusplus.com/reference/" rel="nofollow">http://www.cplusplus.com/reference/</a></p>
<p>Grüssli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1609523</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1609523</guid><dc:creator><![CDATA[Dravere]]></dc:creator><pubDate>Mon, 03 Nov 2008 15:16:08 GMT</pubDate></item><item><title><![CDATA[Reply to speichern einer datei on Mon, 03 Nov 2008 15:19:05 GMT]]></title><description><![CDATA[<p><strong>@ Dravere:</strong><br />
Stimmt, den Fall hab ich nicht beachtet, sorry.</p>
<p><strong>@ manbearpig:</strong><br />
Ich würde mir trotzdem noch einmal die Grundlagen ein wenig anschauen, sonst hast du nicht lange bis zu deinem nächsten Problem. <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1609527</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1609527</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Mon, 03 Nov 2008 15:19:05 GMT</pubDate></item></channel></rss>