using System;
using System.IO;
public class BmpFile
{
public static void Main()
{
byte data1, data2;
//Open file
BinaryReader myFile;
myFile = new BinaryReader(File.Open("1.bmp", FileMode.Open));
// Read data
data1 = myFile.ReadByte();
data2 = myFile.ReadByte();
//Close file
myFile.Close();
//Check Data
if ((data1 == 0x42) && (data2 == 0x4D)) // B M
Console.WriteLine("It seems to be a BMP file");
else
Console.WriteLine("It DOES NOT seem to be a BMP file");
}
}