Thread: read bit's from any file

  1. #1
    Registered User scrapedbr's Avatar
    Join Date
    May 2003

    read bit's from any file

    Hi, i want to read bit-to-bit from a file, and do comparison's with that.

    something like this:

    int Y = 1;
    int X = 0;

    read from file ( text or binary)
    X = 1 bit, and do the comparison, if (X) find 1, else find 0.
    read 4 bits to X and
    if (X == 1001) be happy
    else nothing.....

    how can i do that ??
    Gobolinux user: 00101100

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    The smallest amount of data you can read from a file is one byte. Once you have that byte in memory, you can use bitwise operations on it in the normal manner
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 10:57 AM