<?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[std::ifstream ließt nicht vorhandenes &#x27;á&#x27;]]></title><description><![CDATA[<p>Ich hab mir von hier: <a href="http://thefree3dmodels.com/stuff/vehicles/ship_boat/13-1-0-622" rel="nofollow">http://thefree3dmodels.com/stuff/vehicles/ship_boat/13-1-0-622</a> ein Boot im obj Dateiformat besorgt. Beim Einlesen der Datei stoße ich auf ein komisches zeichen: 'á' - einfach mal den Code von unten damit laufen lassen - dieses Zeichen taucht aber in der Orginaldatei nicht auf - woher kommt dieses Zeichen? Wenn ich das Array data wieder rausschreibe taucht dort auch nicht das Zeichen 'á' auf.</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;cassert&gt;
#include &lt;vector&gt;
#include &lt;fstream&gt;
using namespace std;

int main()
{
	std::ifstream infile;
	infile.open(&quot;Ship - boat.obj&quot;, std::ios::binary);
	infile.seekg(0, std::ios::end);
	size_t file_size_in_byte = infile.tellg();
	infile.seekg(0, std::ios::beg);
	std::vector&lt;char&gt; data;
	data.resize(file_size_in_byte);
	infile.read(&amp;data[0], file_size_in_byte);

	// Check data
	for (int i = 0; i &lt; file_size_in_byte; i++)
	{
		unsigned char c = data[i];

		if (isdigit(c) || 
			isalpha(c) ||
			c == '('   ||
			c == '_'   ||
			c == ')'   ||
			c == '-'   ||
			c == '+'   ||
			c == '/'   ||
			c == '#'   ||
			c == '.'   ||
			c == ','   ||
			c == '\n'  ||
			c == '\t'  ||
			c == ' ')
		{
			// alles okay...
		}
		else
		{
			// was für ein komische Zeichen? 
			std::ofstream outfile(&quot;debugobj2.txt&quot;);
			outfile &lt;&lt; data[i];

			// davor
			for (int a = 0; a &lt; 100; a++)
				outfile &lt;&lt; data[i-(100-a+1)];

			for (int a = 0; a &lt; 100; a++)
				outfile &lt;&lt; data[i+a];
		}
	}

	return 0;
}
</code></pre>
<p>wenn ich statt</p>
<pre><code>unsigned char c = data[i];
</code></pre>
<p>folgendes verwende:</p>
<pre><code>char c = data[i];
</code></pre>
<p>erhalte ich eine felgeschlagen Assertion in isdigit() - warum ist das so?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/313620/std-ifstream-ließt-nicht-vorhandenes-á</link><generator>RSS for Node</generator><lastBuildDate>Sun, 02 Aug 2026 07:25:59 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/313620.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 05 Feb 2013 22:40:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::ifstream ließt nicht vorhandenes &#x27;á&#x27; on Tue, 05 Feb 2013 22:40:23 GMT]]></title><description><![CDATA[<p>Ich hab mir von hier: <a href="http://thefree3dmodels.com/stuff/vehicles/ship_boat/13-1-0-622" rel="nofollow">http://thefree3dmodels.com/stuff/vehicles/ship_boat/13-1-0-622</a> ein Boot im obj Dateiformat besorgt. Beim Einlesen der Datei stoße ich auf ein komisches zeichen: 'á' - einfach mal den Code von unten damit laufen lassen - dieses Zeichen taucht aber in der Orginaldatei nicht auf - woher kommt dieses Zeichen? Wenn ich das Array data wieder rausschreibe taucht dort auch nicht das Zeichen 'á' auf.</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;cassert&gt;
#include &lt;vector&gt;
#include &lt;fstream&gt;
using namespace std;

int main()
{
	std::ifstream infile;
	infile.open(&quot;Ship - boat.obj&quot;, std::ios::binary);
	infile.seekg(0, std::ios::end);
	size_t file_size_in_byte = infile.tellg();
	infile.seekg(0, std::ios::beg);
	std::vector&lt;char&gt; data;
	data.resize(file_size_in_byte);
	infile.read(&amp;data[0], file_size_in_byte);

	// Check data
	for (int i = 0; i &lt; file_size_in_byte; i++)
	{
		unsigned char c = data[i];

		if (isdigit(c) || 
			isalpha(c) ||
			c == '('   ||
			c == '_'   ||
			c == ')'   ||
			c == '-'   ||
			c == '+'   ||
			c == '/'   ||
			c == '#'   ||
			c == '.'   ||
			c == ','   ||
			c == '\n'  ||
			c == '\t'  ||
			c == ' ')
		{
			// alles okay...
		}
		else
		{
			// was für ein komische Zeichen? 
			std::ofstream outfile(&quot;debugobj2.txt&quot;);
			outfile &lt;&lt; data[i];

			// davor
			for (int a = 0; a &lt; 100; a++)
				outfile &lt;&lt; data[i-(100-a+1)];

			for (int a = 0; a &lt; 100; a++)
				outfile &lt;&lt; data[i+a];
		}
	}

	return 0;
}
</code></pre>
<p>wenn ich statt</p>
<pre><code>unsigned char c = data[i];
</code></pre>
<p>folgendes verwende:</p>
<pre><code>char c = data[i];
</code></pre>
<p>erhalte ich eine felgeschlagen Assertion in isdigit() - warum ist das so?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2296324</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2296324</guid><dc:creator><![CDATA[Agin34]]></dc:creator><pubDate>Tue, 05 Feb 2013 22:40:23 GMT</pubDate></item><item><title><![CDATA[Reply to std::ifstream ließt nicht vorhandenes &#x27;á&#x27; on Tue, 05 Feb 2013 23:01:51 GMT]]></title><description><![CDATA[<p>Agin34 schrieb:</p>
<blockquote>
<p>Ich hab mir von hier: <a href="http://thefree3dmodels.com/stuff/vehicles/ship_boat/13-1-0-622" rel="nofollow">http://thefree3dmodels.com/stuff/vehicles/ship_boat/13-1-0-622</a> ein Boot im obj Dateiformat besorgt. Beim Einlesen der Datei stoße ich auf ein komisches zeichen: 'á' - einfach mal den Code von unten damit laufen lassen - dieses Zeichen taucht aber in der Orginaldatei nicht auf - woher kommt dieses Zeichen? Wenn ich das Array data wieder rausschreibe taucht dort auch nicht das Zeichen 'á' auf.</p>
</blockquote>
<p>Oje...ich leide unter Langeweile heute... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Schau Dir mal Zeile 103991 Deiner .obj Datei an, da ist Kauderwelsch...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2296330</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2296330</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Tue, 05 Feb 2013 23:01:51 GMT</pubDate></item><item><title><![CDATA[Reply to std::ifstream ließt nicht vorhandenes &#x27;á&#x27; on Tue, 05 Feb 2013 23:08:52 GMT]]></title><description><![CDATA[<p>oh... tatsächlich ....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2296333</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2296333</guid><dc:creator><![CDATA[Agin34]]></dc:creator><pubDate>Tue, 05 Feb 2013 23:08:52 GMT</pubDate></item></channel></rss>