How to output characters read as "00", in hex, to a file

This is a discussion on How to output characters read as "00", in hex, to a file within the C++ Programming forums, part of the General Programming Boards category; I've succefully outputted all kinds of hex values to files, except the value "00", it is simply ignored. I know ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    367

    How to output characters read as "00", in hex, to a file

    I've succefully outputted all kinds of hex values to files, except the value "00", it is simply ignored. I know it is possible, because I know a program that does it. I've also tried outputting "\0", which is also ignored.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Did you open the file in binary mode?

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    367
    No

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    That is one problem. Also if you are using ofstream or fstream to write to the file, use the write() function to output hex 00.

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    367
    Thanks for the advice

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  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. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  5. Simple File Creation Algorithm
    By muffin in forum C Programming
    Replies: 13
    Last Post: 08-24-2001, 03:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21