<?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[Brauch Hilfe beim laden eines BMP Headers]]></title><description><![CDATA[<p>Hi</p>
<p>ich möchte ein einfaches BMP einlesen, doch leider happerts da schon beim BMP header. Ich bekomm einfach nicht die richtigen Werte in meine struktur. Um den Fehler zu finden, hab ich mir einfach mal die Visual Structur BITMAPFILEHEADER als Vorbild genommen, und die einfach nachgebaut, doch leider funktionierts auch mit der nicht.</p>
<pre><code class="language-cpp">typedef unsigned char	byte;
typedef unsigned short int word;
typedef unsigned long	dword;

typedef struct st_bmpheader
{
	word	w_signatur;
	dword	dw_size;
	word	w_reserved1;
	word	w_reserved2;
	dword	dw_dataoffset;
}st_bempheader1;

BITMAPFILEHEADER Header;
st_bmpheader header;

fseek(pf_file,0,0);
fread(&amp;header,sizeof(st_bmpheader),1,pf_file);
fseek(pf_file,0,0);
fread(&amp;Header,sizeof(BITMAPFILEHEADER),1,pf_file);
</code></pre>
<p>Meine struktur (st_bempheader) hat die selben Variablen also vom gleichen Typ, wie BITMAPFILEHEADER, allerdings lese ich mit der BITMAPFILEHEADER Struktur gültige Werte ein und mit meiner nicht. Um das noch zu toppen, liefert meine Struktur bei einem sizeof() den wert 16 und die BITMAPFILEHEADER 14.</p>
<p>WIE? &amp;&amp; WARUM?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/70253/brauch-hilfe-beim-laden-eines-bmp-headers</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 04:25:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/70253.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 Apr 2004 21:10:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Brauch Hilfe beim laden eines BMP Headers on Mon, 05 Apr 2004 21:10:41 GMT]]></title><description><![CDATA[<p>Hi</p>
<p>ich möchte ein einfaches BMP einlesen, doch leider happerts da schon beim BMP header. Ich bekomm einfach nicht die richtigen Werte in meine struktur. Um den Fehler zu finden, hab ich mir einfach mal die Visual Structur BITMAPFILEHEADER als Vorbild genommen, und die einfach nachgebaut, doch leider funktionierts auch mit der nicht.</p>
<pre><code class="language-cpp">typedef unsigned char	byte;
typedef unsigned short int word;
typedef unsigned long	dword;

typedef struct st_bmpheader
{
	word	w_signatur;
	dword	dw_size;
	word	w_reserved1;
	word	w_reserved2;
	dword	dw_dataoffset;
}st_bempheader1;

BITMAPFILEHEADER Header;
st_bmpheader header;

fseek(pf_file,0,0);
fread(&amp;header,sizeof(st_bmpheader),1,pf_file);
fseek(pf_file,0,0);
fread(&amp;Header,sizeof(BITMAPFILEHEADER),1,pf_file);
</code></pre>
<p>Meine struktur (st_bempheader) hat die selben Variablen also vom gleichen Typ, wie BITMAPFILEHEADER, allerdings lese ich mit der BITMAPFILEHEADER Struktur gültige Werte ein und mit meiner nicht. Um das noch zu toppen, liefert meine Struktur bei einem sizeof() den wert 16 und die BITMAPFILEHEADER 14.</p>
<p>WIE? &amp;&amp; WARUM?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/495875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/495875</guid><dc:creator><![CDATA[mm-motm~]]></dc:creator><pubDate>Mon, 05 Apr 2004 21:10:41 GMT</pubDate></item><item><title><![CDATA[Reply to Brauch Hilfe beim laden eines BMP Headers on Mon, 05 Apr 2004 21:43:32 GMT]]></title><description><![CDATA[<p>du solltest dir schon die gesamte Struktur zum Vorbild nehmen:</p>
<pre><code class="language-cpp">#include &lt;pshpack2.h&gt;
typedef struct tagBITMAPFILEHEADER {
        WORD    bfType;
        DWORD   bfSize;
        WORD    bfReserved1;
        WORD    bfReserved2;
        DWORD   bfOffBits;
} BITMAPFILEHEADER, FAR *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER;
#include &lt;poppack.h&gt;
</code></pre>
<p>und pshpack2.h sieht so aus:</p>
<pre><code class="language-cpp">/*++

Copyright (c) Microsoft Corporation.  All rights reserved.

Module Name:

    pshpack2.h

Abstract:

    This file turns 2 byte packing of structures on.  (That is, it disables
    automatic alignment of structure fields.)  An include file is needed
    because various compilers do this in different ways.  For Microsoft
    compatible compilers, this files uses the push option to the pack pragma
    so that the poppack.h include file can restore the previous packing
    reliably.

    The file poppack.h is the complement to this file.

--*/

#if ! (defined(lint) || defined(RC_INVOKED))
#if ( _MSC_VER &gt;= 800 &amp;&amp; !defined(_M_I86)) || defined(_PUSHPOP_SUPPORTED)
#pragma warning(disable:4103)
#if !(defined( MIDL_PASS )) || defined( __midl )
#pragma pack(push,2)
#else
#pragma pack(2)
#endif
#else
#pragma pack(2)
#endif
#endif // ! (defined(lint) || defined(RC_INVOKED))
</code></pre>
<p>und poppack.h:</p>
<pre><code class="language-cpp">/*++

Copyright (c) Microsoft Corporation.  All rights reserved.

Module Name:

    poppack.h

Abstract:

    This file turns packing of structures off.  (That is, it enables
    automatic alignment of structure fields.)  An include file is needed
    because various compilers do this in different ways.

    poppack.h is the complement to pshpack?.h.  An inclusion of poppack.h
    MUST ALWAYS be preceded by an inclusion of one of pshpack?.h, in one-to-one
    correspondence.

    For Microsoft compatible compilers, this file uses the pop option
    to the pack pragma so that it can restore the previous saved by the
    pshpack?.h include file.

--*/

#if ! (defined(lint) || defined(RC_INVOKED))
#if ( _MSC_VER &gt;= 800 &amp;&amp; !defined(_M_I86)) || defined(_PUSHPOP_SUPPORTED)
#pragma warning(disable:4103)
#if !(defined( MIDL_PASS )) || defined( __midl )
#pragma pack(pop)
#else
#pragma pack()
#endif
#else
#pragma pack()
#endif
#endif // ! (defined(lint) || defined(RC_INVOKED))
</code></pre>
<p>d.h. um deine struktur fehlt ein #pragma pack(push,2) davor und ein #pragma pack(pop) danach.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/495888</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/495888</guid><dc:creator><![CDATA[dEUs]]></dc:creator><pubDate>Mon, 05 Apr 2004 21:43:32 GMT</pubDate></item><item><title><![CDATA[Reply to Brauch Hilfe beim laden eines BMP Headers on Tue, 06 Apr 2004 20:49:18 GMT]]></title><description><![CDATA[<p>aha, seltsam, ich habe die</p>
<p>pshpack2.h oder poppack.h</p>
<p>eigentlich nicht gebraucht um das programm zu kompilieren.</p>
<p>wdw. was bedeutet<br />
#pragma pack(push,2) und #pragma pack(pop) ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/496527</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/496527</guid><dc:creator><![CDATA[mm-motm~]]></dc:creator><pubDate>Tue, 06 Apr 2004 20:49:18 GMT</pubDate></item><item><title><![CDATA[Reply to Brauch Hilfe beim laden eines BMP Headers on Wed, 07 Apr 2004 04:29:30 GMT]]></title><description><![CDATA[<p>{<br />
CBitmap TempBMP;<br />
BITMAP BMPHeader;</p>
<p>HBITMAP hBmp = (HBITMAP)::LoadImage( NULL, &quot;bilddatei&quot;, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);<br />
if(hBmp != NULL)<br />
{<br />
TempBMP.Attach(hBmp);<br />
TempBMP.GetBitmap(BMPHeader))<br />
}<br />
}<br />
// in der BMPHeader sind nun alle infos inkl. die Pixel.</p>
<p>leider hatte ich oft das problem, dass ich nicht alle BMP laden konnte.<br />
musste sie dann erst mit PSP (PaintShopPro) laden und dann speicher unter ...<br />
hmm ?? weiss ich auch nicht woran das lag ??</p>
<p>wie auch immer<br />
vieleicht hilft es dir ja</p>
<p>gruß<br />
volker</p>
<p>Gruß<br />
Volker</p>
]]></description><link>https://www.c-plusplus.net/forum/post/496593</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/496593</guid><dc:creator><![CDATA[excess]]></dc:creator><pubDate>Wed, 07 Apr 2004 04:29:30 GMT</pubDate></item></channel></rss>