📄 bmp2dat_gray.cpp
字号:
// bmp2dat_gray.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
FILE *in;
errno_t err;
err = fopen_s(&in,"./gray3noised.bmp","r");
ofstream out("gray3.dat");
fseek(in,0,SEEK_END);
int size=0,datastart=0x0436-1;
size = ftell(in);
unsigned int ch;
unsigned char ach;
out<<"1651 1 0 0 0"<<endl;
for(long i=size-1;i>datastart;i--)
{
fseek(in,i,SEEK_SET);
ch = fgetc(in);
ach=ch;
ch=ach;
out<<"0x"<<setw(4)<<setfill('0');
out<<hex<<ch<<endl;
out.flush();
}
out.close();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -