Skip to content

Instantly share code, notes, and snippets.

@agaikwad123
Created May 8, 2016 23:56
Show Gist options
  • Save agaikwad123/331a31b1d3de192057c12194804ab59c to your computer and use it in GitHub Desktop.
Save agaikwad123/331a31b1d3de192057c12194804ab59c to your computer and use it in GitHub Desktop.
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<graphics.h>
struct fh
{
unsigned int bftype;
unsigned long bfsize;
unsigned int bfreserved1;
unsigned int bfreserved2;
unsigned long offbits;
}f;
struct in
{
unsigned long bisize;
unsigned long biwidth;
unsigned long biheight;
unsigned int biplanes;
unsigned int bicount;
unsigned long bicompression;
unsigned long bisizeimage;
unsigned long bixpel;
unsigned long biypel;
unsigned long biclrusd;
unsigned long biclrimp;
}i;
void main()
{
FILE *fp;
char source[100];
clrscr();
printf("\n Enter Source file name:\n");
gets(source);
fp=fopen(source,"r+b");
if(fp==NULL)
{
printf("\t Error in opening the file:\n");
getch();
}
fread(&f,sizeof (f),1,fp);
fread(&i,sizeof (i),1,fp);
printf("\n FILE TYPE:");
if(f.bftype==19778)
{
printf("\n Its a bitmap file \n");
}
else
{
printf("\n in vaild file format\n");
getch();
}
printf("\n bitype=%d\n",f.bftype);
printf("\n bisize=%ld\n",f.bfsize);
printf("\n bireserved1=%d\n",f.bfreserved1);
printf("\n bireserved2=%d\n",f.bfreserved2);
printf("\n offbits=%ld\n",f.offbits);
printf("\n bisize=%ld\n",i.bisize);
printf("\n biwidth=%ld\n",i.biwidth);
printf("\nbiheight=%ld\n",i.biheight);
printf("\nbiplanes=%d\n",i.biplanes);
printf("\nbicount=%d\n",i.bicount);
printf("\n bicompression=%ld\n",i.bicompression);
printf("\n bisizeimage=%ld\n",i.bisizeimage);
printf("\n bixpel=%ld\n",i.bixpel);
printf("\n biypel=%ld\n",i.biypel);
printf("\n biclrusd=%ld\n",i.biclrusd);
printf("\n biclrimp=%ld\n",i.biclrimp);
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment