<?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[BIN-Datei einlesen?]]></title><description><![CDATA[<p>Hi all,<br />
ich habe ein Programm geschrieben, das ein 3d BOOL-Array folgendermaßen abspeichert:</p>
<pre><code class="language-cpp">BOOL myPicture[256][16][8];

...

unsigned char a[16];
int iPic,x,y;
CFile file(sFilename, CFile::modeWrite | CFile::typeBinary | CFile::modeCreate, &amp;error);
for(iPic=0;iPic&lt;256;iPic++){ 
    for(x=0;x&lt;16;x++) {
	    a[x]=0;
	    for(y=7;y&gt;=0;y--) {
	        a[x] = a[x] &lt;&lt; 1;
	        if(myPicture[iPic][x][y] == TRUE) a[x] = a[x] | 1;
        }
        file.Write(&amp;a[x],1);
    }
}
file.Close();
</code></pre>
<p>So erhalte ich die gewünschte BIN-File.<br />
Jetzt stellt sich mir nur die Frage wie ich die datei wieder in mein 3d-BOOL-Array einlese?<br />
Kann mir da jemand nen Tip geben?<br />
Thx</p>
<p><sub>Gh05t</sub></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/64981/bin-datei-einlesen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 05 Jun 2026 03:49:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/64981.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Feb 2004 16:32:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to BIN-Datei einlesen? on Sun, 15 Feb 2004 16:32:43 GMT]]></title><description><![CDATA[<p>Hi all,<br />
ich habe ein Programm geschrieben, das ein 3d BOOL-Array folgendermaßen abspeichert:</p>
<pre><code class="language-cpp">BOOL myPicture[256][16][8];

...

unsigned char a[16];
int iPic,x,y;
CFile file(sFilename, CFile::modeWrite | CFile::typeBinary | CFile::modeCreate, &amp;error);
for(iPic=0;iPic&lt;256;iPic++){ 
    for(x=0;x&lt;16;x++) {
	    a[x]=0;
	    for(y=7;y&gt;=0;y--) {
	        a[x] = a[x] &lt;&lt; 1;
	        if(myPicture[iPic][x][y] == TRUE) a[x] = a[x] | 1;
        }
        file.Write(&amp;a[x],1);
    }
}
file.Close();
</code></pre>
<p>So erhalte ich die gewünschte BIN-File.<br />
Jetzt stellt sich mir nur die Frage wie ich die datei wieder in mein 3d-BOOL-Array einlese?<br />
Kann mir da jemand nen Tip geben?<br />
Thx</p>
<p><sub>Gh05t</sub></p>
]]></description><link>https://www.c-plusplus.net/forum/post/459916</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/459916</guid><dc:creator><![CDATA[~Gh05t~]]></dc:creator><pubDate>Sun, 15 Feb 2004 16:32:43 GMT</pubDate></item><item><title><![CDATA[Reply to BIN-Datei einlesen? on Sun, 15 Feb 2004 17:00:44 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>genauso wie du schreibst, bloß andersrum <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<pre><code class="language-cpp">CFile::Read(bool_variable, sizeof(BOOL));
</code></pre>
<p>Sooft, bis das Dateiende erreicht ist.</p>
<p>Grüße Rapha</p>
]]></description><link>https://www.c-plusplus.net/forum/post/459930</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/459930</guid><dc:creator><![CDATA[Rapha]]></dc:creator><pubDate>Sun, 15 Feb 2004 17:00:44 GMT</pubDate></item><item><title><![CDATA[Reply to BIN-Datei einlesen? on Sun, 15 Feb 2004 17:10:15 GMT]]></title><description><![CDATA[<p>Das ist mein Problem nicht...<br />
Wie bekomme ich die Daten wieder in mein Array? Ansatz habe ich schon:</p>
<pre><code class="language-cpp">CFile file(sFilename, CFile::modeRead | CFile::typeBinary, &amp;error);
int iPic,x,y;
unsigned char a;
DWORD dwRead;
for(iPic=0;iPic&lt;256 &amp;&amp; dwRead &gt; 0;iPic++) 
	for(x=0;x&lt;16 &amp;&amp; dwRead &gt; 0;x++) {
		dwRead = file.Read(&amp;a,1);
		for(y=7;y&gt;=0 &amp;&amp; dwRead &gt; 0;y--){
			//myPicture[iPic][x][y] = ??;
		}
	}
</code></pre>
<p>In dem char a habe ich nun einen Zahlenwert zwischen 0 und 255 (8 Bit). Der soll auf die 8 Felder in der 3. Dimension meines Arrays bitweise verteilt werden. Nur weis ich nicht wie ich das machen soll (außer mit SEHR unschönen if abfragen <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/459934</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/459934</guid><dc:creator><![CDATA[~Gh05t~]]></dc:creator><pubDate>Sun, 15 Feb 2004 17:10:15 GMT</pubDate></item></channel></rss>