读取raw文件

void CReadrawFileDlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码

FILE *billImage;
int imageHeight=188;
int imageWidth=448;

unsigned char billPixel[188][448];
unsigned char pixels[84224];

if((billImage=fopen("E:\\temp.raw", "rb"))==NULL)
{ //cout<<"cannot open file\n";
//exit(0);
}

fread(pixels, sizeof(unsigned char) , imageHeight*imageWidth, billImage);
int cout = 0;
for (int i=0; i<imageHeight; i++)
{
for (int j=0; j<imageWidth; j++)
{
int m=0;
billPixel[i][j]=pixels[m];
m++;
cout ++;
//if(cout==6)
//break;
}

}
for (int i=0; i<imageHeight; i++) {
for (int j=0; j<imageWidth; j++)
{
//cout<< billPixel[i][j];
}
}
fclose(billImage);

}
原文地址:https://www.cnblogs.com/wainiwann/p/2433950.html