bmp资料转jpg文件-获取bmp数据

bmp文件转jpg文件---获取bmp数据
FILE* pFile = fopen(pFilePath, "rb");
if(pFile != NULL)
{	
	int nClose = 1;												
	BITMAPFILEHEADER bmpFileHeader = {0};
	if(fread(&bmpFileHeader, sizeof(bmpFileHeader), 1, pFile) == 1)
	{
		BITMAPINFO	bmpInfo;
		if(fread(&bmpInfo, sizeof(bmpInfo)-4, 1, pFile) == 1)
		{
			int nRgbDataLen = bmpInfo.bmiHeader.biWidth*abs(bmpInfo.bmiHeader.biHeight)*bmpInfo.bmiHeader.biBitCount/8;
			char* pRgbData = new char[nRgbDataLen+1];
			memset(pRgbData, 0, nRgbDataLen+1);
			if(fread(pRgbData, nRgbDataLen, 1, pFile) == 1)
			{
				nClose = 0;													
				fclose(pFile);					
				int nBitBytes = bmpInfo.bmiHeader.biBitCount/8;									
				//这里可以使用jpge的lib库把rgb转jpeg的函数进行转成jpeg文件
				
			}																		delete[] pRgbData;
		}
	}
	if(nClose == 1)
		fclose(pFile);
}