Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "stdio.h"
- #include "windows.h"
- typedef struct fileheader{
- char type[2];
- unsigned int size; //specifies the size in bytes of the bitmap file
- short bfReserved1; //reserved; must be 0
- short bfReserved2; //reserved; must be 0
- unsigned int bOffBits; //species the offset in bytes from the bitmapfileheader to the bitmap bits
- }fileheader;
- typedef struct tagbminfo
- {
- DWORD biSize; //specifies the number of bytes required by the struct
- int biWidth; //specifies width in pixels
- int biHeight; //species height in pixels
- WORD biPlanes; //specifies the number of color planes, must be 1
- WORD biBitCount; //specifies the number of bit per pixel
- DWORD biCompression;//spcifies the type of compression
- DWORD biSizeImage; //size of image in bytes
- LONG biXPelsPerMeter; //number of pixels per meter in x axis
- LONG biYPelsPerMeter; //number of pixels per meter in y axis
- DWORD biClrUsed; //number of colors used by th ebitmap
- DWORD biClrImportant; //number of colors that are important
- }tagbminfo;
- int main(){
- FILE *bm;
- fileheader bmtytul;
- tagbminfo bminfo;
- char *bmobraz;
- int a;
- bm=fopen("C:\\Users\\Lenovo\\Desktop\\OBRAZEK.bmp","rb");
- if(bm==NULL){
- printf("error");
- return 0;
- }
- fread(&bmtytul,sizeof(fileheader),1,bm);
- fread(&bminfo,sizeof(tagbminfo),1,bm);
- printf("%c%c",bmtytul.type[0],bmtytul.type[1]);
- printf("\n%i",bmtytul.size);
- getchar();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement