write only one bit to file
-
I don't know how to write to binary file only one bit and not one byte. Please help me! FileStream fs new FileStream("1.dat", FileMode.CreateNew); BinaryWriter w = new BinaryWriter(fs); w.Write(true); //write one byte w.Write(55); //write 4 bytes fs.Close(); Thanks
-
I don't know how to write to binary file only one bit and not one byte. Please help me! FileStream fs new FileStream("1.dat", FileMode.CreateNew); BinaryWriter w = new BinaryWriter(fs); w.Write(true); //write one byte w.Write(55); //write 4 bytes fs.Close(); Thanks
The smallest unit you can write to a file is 1 byte. Even though you're writing a single bit to a file, any file operation you try and use will only write a single byte to store your bit in. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
I don't know how to write to binary file only one bit and not one byte. Please help me! FileStream fs new FileStream("1.dat", FileMode.CreateNew); BinaryWriter w = new BinaryWriter(fs); w.Write(true); //write one byte w.Write(55); //write 4 bytes fs.Close(); Thanks
the overloaded BinaryWriter.Write() method does not support anything smaller than a byte, which is the smallest natural unit. Note that the
bool
type is not a bit long. You can try using aBitArray
, but i'm not sure this will help, and it's not very efficient. there are no facts, only interpretations