Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.47 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "stdio.h"
  3. #include "windows.h"
  4.  
  5. typedef struct fileheader{
  6.     char type[2];
  7.     unsigned int size;  //specifies the size in bytes of the bitmap file
  8.     short bfReserved1;  //reserved; must be 0
  9.     short bfReserved2;  //reserved; must be 0
  10.     unsigned int bOffBits;  //species the offset in bytes from the bitmapfileheader to the bitmap bits
  11. }fileheader;
  12.  
  13. typedef struct tagbminfo
  14. {
  15.     DWORD biSize;  //specifies the number of bytes required by the struct
  16.     int biWidth;  //specifies width in pixels
  17.     int biHeight;  //species height in pixels
  18.     WORD biPlanes; //specifies the number of color planes, must be 1
  19.     WORD biBitCount; //specifies the number of bit per pixel
  20.     DWORD biCompression;//spcifies the type of compression
  21.     DWORD biSizeImage;  //size of image in bytes
  22.     LONG biXPelsPerMeter;  //number of pixels per meter in x axis
  23.     LONG biYPelsPerMeter;  //number of pixels per meter in y axis
  24.     DWORD biClrUsed;  //number of colors used by th ebitmap
  25.     DWORD biClrImportant;  //number of colors that are important
  26. }tagbminfo;
  27.  
  28.  
  29. int main(){
  30.     FILE *bm;
  31.     fileheader bmtytul;
  32.     tagbminfo bminfo;
  33.     char *bmobraz;
  34.     int a;
  35.  
  36.     bm=fopen("C:\\Users\\Lenovo\\Desktop\\OBRAZEK.bmp","rb");
  37.         if(bm==NULL){
  38.             printf("error");
  39.             return 0;
  40.         }
  41.  
  42.     fread(&bmtytul,sizeof(fileheader),1,bm);
  43.     fread(&bminfo,sizeof(tagbminfo),1,bm);
  44.     printf("%c%c",bmtytul.type[0],bmtytul.type[1]);
  45.     printf("\n%i",bmtytul.size);
  46.     getchar();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement