Thread: reading/writing bits from/to a file

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    13

    reading/writing bits from/to a file

    Is there a way to read bits for bits from a file and then write bit for bit to a file in c++?

  2. #2
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    No. All reads and writes operate, at the smallest, on bytes. In fact, by the very definition of a byte, it is the smallest addressible unit of storage.

    Every variable, every read and write, etc. operate on integer numbers of bytes.

  3. #3
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    To elaborate on what Cat said, you have to read it out as a byte (or more), but you can still access the individual bits of the variables you read out of the file by using bit shifting.
    Away.

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    13
    Ok, tnx.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Replies: 4
    Last Post: 07-05-2002, 08:03 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM