<?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[Ascii Zeichen bei ofstream]]></title><description><![CDATA[<p>Hallo ich hab folgendes Programm geschrieben.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

int main()
{

char key[256];
char eingabe[256];

cout&lt;&lt;&quot;Eingabe: &quot;;
cin&gt;&gt;eingabe;

eingabe[256] = '\0';

        for (int i=0;i&lt;4;i++)
        {
                if (eingabe[i] == 'a')
                {

                key[i] = '1';

                }

                if (eingabe[i] == 'b')
                {
                key[i] = '2';

                }

                if (eingabe[i] == 'c')
                {
                key[i] = '3';

                }

}

cout&lt;&lt;&quot;Verschl\x81\sslung: &quot;&lt;&lt; key  &lt;&lt;&quot;\n&quot;;

ofstream key_txt (&quot;key.txt&quot;);
         key_txt&lt;&lt;key;

return 0;
}
</code></pre>
<p>Nur immer wenn ich den Befehl ofstream in das Programm mit eingebe dann kommen immer irgendwelche Ascii Zeichen oder so nach der Ausgabe...</p>
<p>z.b. sowas ¶’|˜²’|</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/224788/ascii-zeichen-bei-ofstream</link><generator>RSS for Node</generator><lastBuildDate>Fri, 02 Oct 2026 03:29:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/224788.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 15 Oct 2008 08:30:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ascii Zeichen bei ofstream on Wed, 15 Oct 2008 08:30:35 GMT]]></title><description><![CDATA[<p>Hallo ich hab folgendes Programm geschrieben.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

int main()
{

char key[256];
char eingabe[256];

cout&lt;&lt;&quot;Eingabe: &quot;;
cin&gt;&gt;eingabe;

eingabe[256] = '\0';

        for (int i=0;i&lt;4;i++)
        {
                if (eingabe[i] == 'a')
                {

                key[i] = '1';

                }

                if (eingabe[i] == 'b')
                {
                key[i] = '2';

                }

                if (eingabe[i] == 'c')
                {
                key[i] = '3';

                }

}

cout&lt;&lt;&quot;Verschl\x81\sslung: &quot;&lt;&lt; key  &lt;&lt;&quot;\n&quot;;

ofstream key_txt (&quot;key.txt&quot;);
         key_txt&lt;&lt;key;

return 0;
}
</code></pre>
<p>Nur immer wenn ich den Befehl ofstream in das Programm mit eingebe dann kommen immer irgendwelche Ascii Zeichen oder so nach der Ausgabe...</p>
<p>z.b. sowas ¶’|˜²’|</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1599177</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599177</guid><dc:creator><![CDATA[key]]></dc:creator><pubDate>Wed, 15 Oct 2008 08:30:35 GMT</pubDate></item><item><title><![CDATA[Reply to Ascii Zeichen bei ofstream on Wed, 15 Oct 2008 10:22:12 GMT]]></title><description><![CDATA[<p>Wenn ich ofstream key_txt (&quot;key.txt&quot;); Global deklariere dann funktioniert es woran liegt das ?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt; 
#include &lt;fstream&gt; 
using namespace std; 

ofstream key_txt (&quot;key.txt&quot;); 

int main() 
{ 

char key[256]; 
char eingabe[256]; 

cout&lt;&lt;&quot;Eingabe: &quot;; 
cin&gt;&gt;eingabe; 

eingabe[256] = '\0'; 

        for (int i=0;i&lt;4;i++) 
        { 
                if (eingabe[i] == 'a') 
                { 

                key[i] = '1'; 

                } 

                if (eingabe[i] == 'b') 
                { 
                key[i] = '2'; 

                } 

                if (eingabe[i] == 'c') 
                { 
                key[i] = '3'; 

                } 

} 

cout&lt;&lt;&quot;Verschl\x81\sslung: &quot;&lt;&lt; key  &lt;&lt;&quot;\n&quot;; 

         key_txt&lt;&lt;key;  
         key_txt.close();

return 0; 
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1599237</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599237</guid><dc:creator><![CDATA[key]]></dc:creator><pubDate>Wed, 15 Oct 2008 10:22:12 GMT</pubDate></item><item><title><![CDATA[Reply to Ascii Zeichen bei ofstream on Thu, 16 Oct 2008 12:25:15 GMT]]></title><description><![CDATA[<p>Weiss den keiner woran das liegt o_O</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1599902</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599902</guid><dc:creator><![CDATA[key]]></dc:creator><pubDate>Thu, 16 Oct 2008 12:25:15 GMT</pubDate></item><item><title><![CDATA[Reply to Ascii Zeichen bei ofstream on Thu, 16 Oct 2008 12:33:22 GMT]]></title><description><![CDATA[<ul>
<li><code>char foo[256]</code> hat 256 Werte, von 0 - 255, 256 ist kein gueltiger Index</li>
</ul>
<p>- Variablen muessen _IMMER_ initalisiert werden, ansonsten haben sie einen undefinierten Inhalt. Das gilt auch fuer die Datenelemente von Arrays</p>
<p>- Dateien muessen geschlossen werden, wenn man sie nichtmehr braucht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1599908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1599908</guid><dc:creator><![CDATA[zwutz]]></dc:creator><pubDate>Thu, 16 Oct 2008 12:33:22 GMT</pubDate></item></channel></rss>