<?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[Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab]]></title><description><![CDATA[<p>Liebe Leser</p>
<p>Ich habe das Problem bei meinen letzten Thread<br />
&quot;wxWidget TextCtrl zeigt nicht all ASCII Symbole&quot; gefunden.<br />
Es lag nicht an WxTextCtrl.</p>
<p>Jedoch habe ich keine Lösung dazu, die ich annehmen könnte.</p>
<p>Ein Beispiel</p>
<p>Ich habe eine Datei die folgende Symbole hat.</p>
<p>&quot;ABCD\0EFG&quot;</p>
<p>Jedoch hat der String nach dem Lesevorgang den Wert &quot;ABCD&quot;.<br />
&quot;\0EFG&quot; Fehlt.</p>
<p>Hier die Funktion</p>
<pre><code>ifstream		Input(FillName, ios::in | ios::binary);

if (!Input)
{
wxMessage(&quot;Fehler&quot;, &quot;Fehler&quot;);
}

Input.seekg(0, fstream::end);
long NumByte = Input.tellg();
Input.seekg(0, fstream::beg);

string			Str;

// Jedes Symbol lesen
char d; 
while (Input.read(reinterpret_cast&lt;char*&gt;(&amp;d), sizeof(d))) 
{ 
Str.push_back(d);
}
</code></pre>
<p>Ich hatte versucht alle '\0' Symbole mit einer if Schleife zu ersetzten.<br />
Jedoch dauerte der Lesevorgang sehr sehr lange.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/328011/ifstream-read-bricht-lesevorgang-bei-ascii-gt-null-symbol-ab</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Jul 2026 16:09:16 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/328011.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Sep 2014 16:24:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Tue, 16 Sep 2014 16:24:33 GMT]]></title><description><![CDATA[<p>Liebe Leser</p>
<p>Ich habe das Problem bei meinen letzten Thread<br />
&quot;wxWidget TextCtrl zeigt nicht all ASCII Symbole&quot; gefunden.<br />
Es lag nicht an WxTextCtrl.</p>
<p>Jedoch habe ich keine Lösung dazu, die ich annehmen könnte.</p>
<p>Ein Beispiel</p>
<p>Ich habe eine Datei die folgende Symbole hat.</p>
<p>&quot;ABCD\0EFG&quot;</p>
<p>Jedoch hat der String nach dem Lesevorgang den Wert &quot;ABCD&quot;.<br />
&quot;\0EFG&quot; Fehlt.</p>
<p>Hier die Funktion</p>
<pre><code>ifstream		Input(FillName, ios::in | ios::binary);

if (!Input)
{
wxMessage(&quot;Fehler&quot;, &quot;Fehler&quot;);
}

Input.seekg(0, fstream::end);
long NumByte = Input.tellg();
Input.seekg(0, fstream::beg);

string			Str;

// Jedes Symbol lesen
char d; 
while (Input.read(reinterpret_cast&lt;char*&gt;(&amp;d), sizeof(d))) 
{ 
Str.push_back(d);
}
</code></pre>
<p>Ich hatte versucht alle '\0' Symbole mit einer if Schleife zu ersetzten.<br />
Jedoch dauerte der Lesevorgang sehr sehr lange.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417843</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417843</guid><dc:creator><![CDATA[Sebastian Müller]]></dc:creator><pubDate>Tue, 16 Sep 2014 16:24:33 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Tue, 16 Sep 2014 16:33:31 GMT]]></title><description><![CDATA[<p>Es gibt keine if-Schleife.</p>
<p>Dein Beispielcode zeigt nirgendwo, dass etwas fehlt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417846</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417846</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Tue, 16 Sep 2014 16:33:31 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Tue, 16 Sep 2014 16:36:33 GMT]]></title><description><![CDATA[<p>Sebastian Müller schrieb:</p>
<blockquote>
<p>Jedoch hat der String nach dem Lesevorgang den Wert &quot;ABCD&quot;.<br />
&quot;\0EFG&quot; Fehlt.</p>
</blockquote>
<p>Nein.<br />
Der String hat danach den Wert ABCD\0EFG, das kannst du mit size() überprüfen.<br />
Das Problem ist nur, dass die meisten Ausgaberoutinen (und Debugger) alles bis zur ersten null ausgeben.<br />
Sie geben deshalb nur ABCD aus, aber die anderen Werte existieren trotzdem.</p>
<p>Und BTW:</p>
<pre><code>reinterpret_cast&lt;char*&gt;(&amp;d)
</code></pre>
<p>Das es ist sinnfrei ist, die Adresse eines chars (d.h. ein char*) nach char* zu reinterpret_casten, ist dir schon klar, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417847</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Tue, 16 Sep 2014 16:36:33 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 08:45:09 GMT]]></title><description><![CDATA[<p>Upps. Ja das Weiß ich. Ich hatte am Code nur 10.000 Mal herum getüftelt, sodass dies Stehenblieb.<br />
Ich weise, das &quot;char* to Char*&quot; keinen Zweck, bzw keine Wirkung hat.</p>
<p>Die If-Schleife hatte ich weggelassen, weil diese zu langsam ist.</p>
<pre><code>if(d = '\0')
{
d = &quot;0&quot;;
}
</code></pre>
<p>Ok. Das konnte ich im Debugger jedoch nicht erkenne. wxTextCtrl zeigt auch nur<br />
bis zum ersten \0 Byte. Kann man das Problem irgendwie lösen, das ich alle Bytes sehen kann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417951</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417951</guid><dc:creator><![CDATA[Sebastian Müller]]></dc:creator><pubDate>Wed, 17 Sep 2014 08:45:09 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 08:51:53 GMT]]></title><description><![CDATA[<p>Sebastian Müller schrieb:</p>
<blockquote>
<p>Die If-Schleife hatte ich weggelassen, weil diese zu langsam ist.</p>
</blockquote>
<p><strong>Es gibt keine if-Schleife</strong></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417952</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Wed, 17 Sep 2014 08:51:53 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 09:10:28 GMT]]></title><description><![CDATA[<pre><code>if(d = '\0')
{
d = &quot;0&quot;;
}
</code></pre>
<p>Aua! Denk da mal drueber nach.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417954</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417954</guid><dc:creator><![CDATA[Hyde++ 0]]></dc:creator><pubDate>Wed, 17 Sep 2014 09:10:28 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 09:21:37 GMT]]></title><description><![CDATA[<pre><code>if(d = '\0')
{
d = &quot;0&quot;;
}
</code></pre>
<p>Aua! Denk da mal drueber nach.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417956</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417956</guid><dc:creator><![CDATA[Hyde++ 0]]></dc:creator><pubDate>Wed, 17 Sep 2014 09:21:37 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 09:58:36 GMT]]></title><description><![CDATA[<p>Achso stimmt. Das passiert mir öfters.</p>
<p>Zuweisungsoperator ist kein Vergleichsoperator.<br />
== wäre besser.</p>
<p>Zurück zum Problem<br />
Kann man alle Zeichen anzeigen lassen?<br />
Ich meine im wxTextCtrl Fenster?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417963</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417963</guid><dc:creator><![CDATA[Sebastian Müller]]></dc:creator><pubDate>Wed, 17 Sep 2014 09:58:36 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 10:09:30 GMT]]></title><description><![CDATA[<pre><code>while(Input.read(&amp;d, sizeof(d)))
{
   if(d == '\0')
      Str.push_back('0'); 
   else
      Str.push_back(d);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2417966</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417966</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Wed, 17 Sep 2014 10:09:30 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 10:21:21 GMT]]></title><description><![CDATA[<p>Ok. Mal angenommen ich möchte die Datei wieder speichern. Muss ich dann jeden Byte, der '0' ist wieder zu '/0' machen, oder erkennt er dass?</p>
<p>Meines Wissen nach ,müsste ich dies wieder ändern. Oder?</p>
<p>Ich habe das eben mit der Schleife nochmal getestet.<br />
Die Schleife selbst ist nicht langsam. Irgendetwas anderes bremst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417970</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417970</guid><dc:creator><![CDATA[Sebastian Müller]]></dc:creator><pubDate>Wed, 17 Sep 2014 10:21:21 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 10:28:31 GMT]]></title><description><![CDATA[<p>Warum willst Du die Datei wieder speichern? Sie ist ja nicht weg, weil Du sie gelesen hast.<br />
Warum liest Du überhaupt jedes Byte einzeln? Vielleicht geht es schneller, wenn Du größere Blöcke oder alles auf einmal liest?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417971</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417971</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Wed, 17 Sep 2014 10:28:31 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 10:38:43 GMT]]></title><description><![CDATA[<p>Sebastian Müller schrieb:</p>
<blockquote>
<p>Meines Wissen nach ,müsste ich dies wieder ändern. Oder?</p>
</blockquote>
<p>Und dabei machst du jede '0', die wirklich in der Datei war, fälschlicherweise zu einer '\0'.</p>
<p>Dein Vorhaben, einen Dateiinhalt samt <strong>nicht druckbaren Zeichen</strong> in einem Steuerelement für Text anzeigen zu wollen, ist grundsätzlich Blödsinn.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417972</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417972</guid><dc:creator><![CDATA[MFK]]></dc:creator><pubDate>Wed, 17 Sep 2014 10:38:43 GMT</pubDate></item><item><title><![CDATA[Reply to Ifstream::read(...) bricht Lesevorgang bei ASCII -&amp;gt; [NULL] Symbol ab on Wed, 17 Sep 2014 12:19:36 GMT]]></title><description><![CDATA[<p>Ich habe es nochmal ergänzt. Jetzt läuft es.</p>
<p>Ich habe mir eh schon gedacht, dass es sinnlos ist, Dateien anzuzeigen, die evt nicht druckbare Zeichen haben.</p>
<p>Mann könnt diese zeichne ja durch andere ersetzten.</p>
<p>\0 -&gt; [NULL]<br />
... usw</p>
<p>Notepad++ mach das auch so;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2417990</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2417990</guid><dc:creator><![CDATA[Sebastian Müller]]></dc:creator><pubDate>Wed, 17 Sep 2014 12:19:36 GMT</pubDate></item></channel></rss>