Reading Binary from files

Dark Kai

Well-known member
Joined
Sep 3, 2003
Messages
48
Hi, Im writing a program to read Bitmaps. Is there a way to read the file bit by bit in vb.net ?? currently im reading it byte by byte and when im reading a 1bit bmp file then i need to convert the bytes that i read to binary which take up a lot of time for processing. Would really appreciate your help. Thanks in advance.
 
take a look at the System.IO.BinaryReader Class. eg:
Code:
Dim bReader As New IO.BinaryReader(New IO.FileStream("C:\Image1.Bmp", IO.FileMode.Open))
    While Not bReader.PeekChar() = -1
        Console.WriteLine(bReader.ReadByte())
    End While
bReader.Close()
 
Thanks dynamic_sysop but the result is still in byte.
example if the first byte in the file is a char "h" then the return value of my reading should be 0100 1000 instead of 104.
 
Back
Top