getting bites from a file
-
I need to be able to get every bit from a file (0 and 1). How do i do this. please help
rzvme
You could try reading all the bytes and then convert this to bits.
-
You could try reading all the bytes and then convert this to bits.
-
Take a look at the
BinaryReader
(read data from the file) andBitArray
(access the data bit-wise).
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
Take a look at the
BinaryReader
(read data from the file) andBitArray
(access the data bit-wise).
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
-
rzvme wrote:
but it retrives bytes
I know. That's why I also pointed you to the
BitArray
class.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
-
You can use the && operator to pull out each bit. myByte && 1 myByte && 2 myByte && 4 etc
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
rzvme wrote:
(in ascii)
ASCII has nothing to do with it. It returns the bytes in whatever format they are on the hard drive.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
rzvme wrote:
(in ascii)
ASCII has nothing to do with it. It returns the bytes in whatever format they are on the hard drive.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
You can use the && operator to pull out each bit. myByte && 1 myByte && 2 myByte && 4 etc
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Nothing reads bits. You need to take each byte and strip off the bits to get the bit you want. If your value is 10001101, then 10001101 & 1 = 1, 10001101 & 10 = 0, 10001101 & 100 = 1, etc.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
I know that, although I don't see why. My point is that what you said is wrong, ASCII has nothing to do with it.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )