{"id":3021,"date":"2026-03-05T08:00:00","date_gmt":"2026-03-05T07:00:00","guid":{"rendered":"https:\/\/www.fuhselab.de\/?p=3021"},"modified":"2026-02-26T07:22:44","modified_gmt":"2026-02-26T06:22:44","slug":"c-textprogramm-version-1","status":"publish","type":"post","link":"https:\/\/www.fuhselab.de\/index.php\/2026\/03\/05\/c-textprogramm-version-1\/","title":{"rendered":"C++ Textprogramm Version 1"},"content":{"rendered":"\n<p><br>Wie w\u00e4re es mal mit einer kleinen Textverarbeitung? In diesem Artikel entwickeln wir die erste Version eines selbst programmierten C++ Textprogramms&#8230;<\/p>\n\n\n\n<!--more-->\n\n\n\n<p><strong>Das C++ Textprogramm Version 1:<\/strong><\/p>\n\n\n\n<p>Unser erstes Textprogramm erlaubt es bereits im Terminal einen Dateinamen (mit Endung txt) einzugeben und in diese so entstandene Datei einen Text zu schreiben, der im Code bereits hinterlegt ist.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;iostream>\n#include &lt;fstream> \n#include &lt;string> \n\nint main() \n{ \nstd::ofstream dat_aus; \nstd::string dateiname; \nstd::cout &lt;&lt; \"Geben Sie den Namen der Datei ein: \"; \nstd::cin >> dateiname; \nstd::cout &lt;&lt; std::endl; \n\ndat_aus.open(dateiname.c_str(), std::ios_base::out); \n\nif(!dat_aus) \n{ \nstd::cout &lt;&lt; \"Datei konnte nicht ge\u00f6ffnet werden!\"; \nstd::cout &lt;&lt; std::endl; \nreturn -1; \n} \n\n\/\/Daten in die Datei schreiben \n\nstd::string text1 = \"Dies ist ein Text.\"; \nstd::string text2 = \"Dies ist ein weiterer Text.\"; \n\n\ndat_aus &lt;&lt; text1 &lt;&lt; std::endl; \ndat_aus &lt;&lt; text2 &lt;&lt; std::endl; \n\n\ndat_aus.close(); \n\nreturn 0; \n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wie w\u00e4re es mal mit einer kleinen Textverarbeitung? In diesem Artikel entwickeln wir die erste Version eines selbst programmierten C++ Textprogramms&#8230;<\/p>\n","protected":false},"author":1,"featured_media":543,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[32],"class_list":["post-3021","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding-club","tag-coding-club-peine"],"_links":{"self":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/3021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/comments?post=3021"}],"version-history":[{"count":1,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/3021\/revisions"}],"predecessor-version":[{"id":3022,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/posts\/3021\/revisions\/3022"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/media\/543"}],"wp:attachment":[{"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/media?parent=3021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/categories?post=3021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fuhselab.de\/index.php\/wp-json\/wp\/v2\/tags?post=3021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}