用c语言编写 求bmp图片的宽度和高度
求代码参考,要用到结构体和指针怎么写
#include <stdio.h>
#include <stdlib.h>
typedef struct BMPINF
{
long Width;
long Height;
};
int main()
{
BMPINF stBMP;
FILE *fp = fopen("test.bmp", "r");
if (fp == NULL)
{
return 0;
}
fseek(fp, 18, 0);
fread(&stBMP, sizeof(BMPINF), 1, fp);
printf("宽: %d\n高: %d\n", stBMP.Width, stBMP.Height);
fclose(fp);
}