在linux下读取bmp文件头的完整代码。
2023-09-27 14:28:16 时间
cout "文件头类型:" pBmpHead.bfType endl;
cout "文件大小:" pBmpHead.bfSize endl;
cout "保留字_1:" pBmpHead.bfReserved1 endl;
cout "保留字_2:" pBmpHead.bfReserved2 endl;
cout "实际位图数据的偏移字节数:" pBmpHead.bfOffBits endl endl;
}
void showBmpInforHead(BITMAPINFODEADER pBmpInforHead){
cout "位图信息头:" endl;
cout "结构体的长度:" pBmpInforHead.biSize endl;
cout "位图宽:" pBmpInforHead.biWidth endl;
cout "位图高:" pBmpInforHead.biHeight endl;
cout "biPlanes平面数:" pBmpInforHead.biPlanes endl;
cout "biBitCount采用颜色位数:" pBmpInforHead.biBitCount endl;
cout "压缩方式:" pBmpInforHead.biCompression endl;
cout "biSizeImage实际位图数据占用的字节数:" pBmpInforHead.biSizeImage endl;
cout "X方向分辨率:" pBmpInforHead.biXPelsPerMeter endl;
cout "Y方向分辨率:" pBmpInforHead.biYPelsPerMeter endl;
cout "使用的颜色数:" pBmpInforHead.biClrUsed endl;
cout "重要颜色数:" pBmpInforHead.biClrImportant endl;
int main( int argc, char **argv )
FILE *fp = fopen(argv[1], "rb");
BITMAPFILEHEADER head;
BITMAPINFODEADER info;
fread( head, 1, sizeof(BITMAPFILEHEADER), fp);
fread( info, 1, sizeof(BITMAPINFODEADER), fp);
showBmpHead(head);
showBmpInforHead(info);
cout sizeof(BITMAPFILEHEADER) endl; cout sizeof(BITMAPINFODEADER) endl;
fclose(fp);
return 0;
相关文章
- 例说linux内核与应用数据通信(三):读写内核设备驱动文件
- Linux中在主机上实现对备机上文件夹及文件的操作的C代码实现
- Linux_文件权限
- Linux df 查看磁盘空间使用量 du 查看指定目录/文件的大小
- linux环境中,如何通过手动创建crontab文件的方式来设置crontab定时调度任务?
- Linux 磁盘管理
- Linux查看网络连接数,统计网络连接数(netstat、Apache连接数)
- Linux Command touch 创建文件
- 如何在Linux上找出并删除重复的文件:FSlint
- 修復linux 文件系統
- linux下如何查看当前机器提供了哪些服务
- linux下递归删除指定后缀名的文件
- linux下使用grep在当前目录下搜索所有文件中含有的字符串
- Linux中没有rc.local文件的解决方法
- 基于C语言实现的Linux系统下邮件系统【100010645】
- Linux网络配置
- 配置Linux内核
- Linux使用github仓库
- Linux打开windows 的txt文件,乱码的问题
- linux 下使用scp命令传输文件
- fsck 修复ext3文件系统(用于linux系统时间不对,文件系统信息有错引起的die with exit status等的一些问题)
- [Linux]Linux环境,如何查找一个目录下所有包含特定字符串的文件
- 查看Linux系统的平均负载
- 【嵌入式Linux学习】7、多文件编译输出Hello Linux!
- linux 文件与进程
- Linux/CentOS下安装MySql RPM Bundle
- Linux从入门到精通——自有服务2