Thread: A little confused about binary files.

  1. #1
    The Defective GRAPE Lurker's Avatar
    Join Date
    Feb 2003
    Posts
    949

    A little confused about binary files.

    I tried to open a Word document in binary mode....and, as I suspected, jibberish came out. How does binary mode truly differ from character streams (besides the replacement of newlines with rectangles ), and how does Word (not to mention many other programs) spit out / read those horrible characters? Thanks a bunch !
    Do not make direct eye contact with me.

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    114
    the only big difference when read a file in normal vs binary is excactly what you said, the system characters are treated as just bytes and nothing else. reading a line from a binary file would prove mostly futile, since the char 10 is not treated as '\n' and thus the reader cant find an end of line. I acctually resently discovered a small bug in my game where i read normal, where i should read binary. but since i treated all data as binary data, there was no change when switching to binary mode...

    a reason why the word doc is rabbish might be that it is in unicode... each char takes two bytes... who knows...

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    It's the formatting.

    The file has all the information for fonts, margins, headers & footers, etc. You can tell that there's a bunch of extra junk in there by looking at the size of the file compared to the size of a .txt file.

    wotsit.com has some documents covering the .doc format.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary comparison from 2 files
    By Filly in forum C Programming
    Replies: 6
    Last Post: 01-16-2008, 06:49 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. Processing binary or plaintext files
    By Jags in forum C Programming
    Replies: 12
    Last Post: 08-04-2006, 02:35 PM
  4. Help with binary files
    By tuxinator in forum C Programming
    Replies: 3
    Last Post: 12-01-2005, 02:11 AM
  5. Copying binary files, like ZIPs
    By frenchfry164 in forum C++ Programming
    Replies: 4
    Last Post: 03-16-2002, 03:54 PM