== Инкапсуляция. Чтение заголовка bmp ==
При компиляции использовать ключ --pack-struct
// Programming 1. Sample at 2017-05-04-14-20.53
#include
union BMP_HEADER
{
char data[14];
struct
{
unsigned short signature;
unsigned int size;
unsigned int reserved12;
unsigned int offset;
} hdr;
};
class BmpImage
{
FILE *m_file;
char *m_data;
const char *m_name;
BMP_HEADER m_header;
public:
BmpImage()
{
m_file = NULL;
m_data = NULL;
m_name = NULL;
}
BmpImage(const char *name)
{
m_name = name;
m_file = NULL;
m_data = NULL;
printf("Hello, I'm created, my name is %s\n",m_name);
}
void print()
{
for(int i=0;i