Click here to Skip to main content
15,913,685 members

Comments by Majd ROG (Top 7 by date)

Majd ROG 28-Dec-14 6:30am View    
Thank you bill, it's work for me, but please i just need a one thing to edit.. can you help me ??
Majd ROG 20-Dec-14 17:29pm View    
Thank you so much @Billwoodruff, this is a great work from you..
I'll try and i'll keep in touch with you.
Just a question, if i dealing with large file like 20,50Mb maybe 100Mb? can i use i MemoryStream Byte-After-Byte?? to make no issues ??
or i must search for a better than MemoryStream BitArray??
Majd ROG 20-Dec-14 15:43pm View    
Thank you so much @BillWoodruff for your help, i'll try in a few hours the code you gave me, just a question, i'll use inside my MemoryStream code, System.Collections.BitArray code you gave me, so MemoryStream read 1 byte then
i'll use your code to convert the 1 byte to array of 8 bits each time.
i think this is good. right? i'll try and let you know.. thank you so much again
Majd ROG 20-Dec-14 7:26am View    
Thank you @BillWoodruff for your assist, actually you'r true..
As you say.. i need to use the 2nd code. using "MemoryStream" to read a file into an Array of Bytes.. then i create a for loop to file length byte after byte.
BUT MY PROBLEM WITH THE SECOND CODE IS.. the code gave me a byte in decimal..
And all of what i need is to want to access to the access the values of the bits in each Byte in that array .. bits after bits ..

string path = openFileDialog1.FileName;
byte[] file = File.ReadAllBytes(path);
MemoryStream memory = new MemoryStream(file);
BinaryReader reader = new BinaryReader(memory);

for (int i = 0; i < file.Length; i++)
{
byte result = reader.ReadByte();
//THIS CODE GIVES ME A ONE BYTE EACH TIME BUT IN DECIMAL !!!!!!
//I NEED TO ACCESS THE BITS IN EACH BYTE LIKE THAT "0,1,1,0,0,0,0,1"
//ACCESS TO INDEX [0] = 0
//Index [1] = 1

}

This code i need to use but i just need to edit the code, so i can read byte after byte but in binary, NOT IN DECIMAL, then.. access to the 8 bits in the 1 byte!
Majd ROG 20-Dec-14 7:17am View    
Thank you @BillWoodruff for your assist, actually you'r true..
As you say.. i need to use the 2nd code. using "MemoryStream" to read a file into an Array of Bytes.. then i create a for loop to file length byte after byte.
BUT MY PROBLEM WITH THE SECOND CODE IS.. the code gave me a byte in decimal..
And all of what i need is to want to access to the access the values of the bits in each Byte in that array .. bits after bits .. by using this code..

string path = openFileDialog1.FileName;
byte[] file = File.ReadAllBytes(path);
MemoryStream memory = new MemoryStream(file);
BinaryReader reader = new BinaryReader(memory);

for (int i = 0; i < file.Length; i++)
{
byte result = reader.ReadByte();
//THIS CODE GIVES ME A ONE BYTE EACH TIME BUT IN DECIMAL !!!!!!
//I NEED TO ACCESS THE BITS IN EACH BYTE LIKE THAT "0,1,1,0,0,0,0,1"
//ACCESS TO INDEX [0] = 0
//Index [1] = 1

}