Thread: Binary Files

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    6

    Binary Files

    I have a binary file that I need to open and alter the first 4 bytes without messing with the rest of the data. How would I go about doing this? I was thinking I could use fwrite but what option would I use with fopen?

  2. #2
    Registered User GL.Sam's Avatar
    Join Date
    Aug 2009
    Posts
    88
    >what option would I use with fopen
    "rb+" obvoiusly is exactly what you want. It says open binary file for reading and writing starting from the beginning of the file.
    The only good is knowledge and the only evil is ignorance.
    ~Socrates

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    6
    wow, can't believe I missed that. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  2. send/recv binary files using sockets in C++
    By dafatdude in forum Networking/Device Communication
    Replies: 14
    Last Post: 07-25-2004, 11:00 AM
  3. MFC: CStrings & binary files question(s)
    By BrianK in forum Windows Programming
    Replies: 0
    Last Post: 06-24-2004, 05:41 PM
  4. Binary files
    By Brian in forum C Programming
    Replies: 2
    Last Post: 02-18-2002, 01:13 PM
  5. storing string objects to binary files
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 10-06-2001, 11:33 PM