请大侠们认真分析小弟我的使用C++的I/O流库读取bmp代码,本人一时也不清楚代码哪里有有关问题

请大侠们认真分析我的使用C++的I/O流库读取bmp代码,本人一时也不清楚代码哪里有问题
最近使用C++的I/O流库读取bmp,将像素值读到一个文本文件中。打开文本文件看了一下,似乎存在问题,但一时找不到问题在哪里,望大侠们指教,谢谢!代码如下:


#include   <iostream>
#include   <fstream>
using   namespace   std;
#include   <windows.h>

#define   WIDTHBYTES(bits)         (((bits)   +   31)   /   32   *   4)

int   main(int   argc,   char*   argv[])
{
char   strBmpFile[_MAX_PATH];
        char   strTxtFile[_MAX_PATH];
cout < < "请输入bmp图片的文件路径 " < <endl;
cin> > strBmpFile;
cout < < "请输入文本文件的路径 " < <endl;
cin> > strTxtFile;
        BITMAPFILEHEADER   BmpFileHead;
ifstream   in(strBmpFile);

if(!in)
{
cout < < "不能打开文件 " < <endl;
return   1;
}
        in.read((char*)&BmpFileHead,sizeof(BITMAPFILEHEADER));
if(BmpFileHead.bfType!=19778)     //   判断输入文件是否是bmp文件,其中19778是字符串 "BM "的十进制形式
{
cout < < "你输入的并不是bmp文件 " < <endl;
return   1;
}

        ofstream   out(strTxtFile);
if(!out)
{
              cout < < "不能打开文件 " < <endl;
return   1;
}

out < < "BitmapFileHeader     " < <endl;
out < < "Type                         " < <BmpFileHead.bfType < <endl;
out < < "Size                         " < <BmpFileHead.bfSize < < "   bytes " < <endl;
out < < "Reserved1               " < <BmpFileHead.bfReserved1 < <endl;
out < < "Reserved2               " < <BmpFileHead.bfReserved2 < <endl;
        out < < "BitmapInfoHeader     " < <endl;
        BITMAPINFO   bmInfo;
        in.read((char*)&bmInfo,sizeof(BITMAPINFOHEADER));
out < < "Size                         " < <bmInfo.bmiHeader.biSize < <endl;
out < < "Width                       " < <bmInfo.bmiHeader.biWidth < <endl;
out < < "Height                     " < <bmInfo.bmiHeader.biHeight < <endl;
out < < "Planes                     " < <bmInfo.bmiHeader.biPlanes < <endl;
out < < "BitCount                 " < <bmInfo.bmiHeader.biBitCount < <endl;
out < < "Compression           " < <bmInfo.bmiHeader.biCompression < <endl;
out < < "SizeImage               " < <bmInfo.bmiHeader.biSizeImage < <endl;
out < < "XPelsPerMeter       " < <bmInfo.bmiHeader.biXPelsPerMeter < <endl;
out < < "YPelsPerMeter         " < <bmInfo.bmiHeader.biYPelsPerMeter < <endl;