Thread: Write ASCII character to a binary file

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    2

    Write ASCII character to a binary file

    Hello everyone,

    I have an issue when writing a C programming code. I have created a binary file using C ("fwrite" statement). But now, I want to add an ASCII string to this file. Is this possible? If so, which statement shall I use? Can anyone show me an example?

    Thanks in advance.

    Tom

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Why not just write the string with another call to fwrite()?

    Jim

  3. #3
    Registered User
    Join Date
    Jun 2012
    Posts
    2
    Quote Originally Posted by jimblumberg View Post
    Why not just write the string with another call to fwrite()?

    Jim
    Hi Jim,

    If I call fwrite again directly, I suppose the string will be stored as binary data in the file.

    Tom

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 06-18-2012, 08:23 AM
  2. Convert function to write ascii instead of binary
    By ofey in forum C Programming
    Replies: 3
    Last Post: 07-16-2010, 04:03 PM
  3. how to write a null character to a file
    By nicoeschpiko in forum C Programming
    Replies: 6
    Last Post: 03-05-2010, 12:27 AM
  4. Write Binary File
    By doia in forum C Programming
    Replies: 14
    Last Post: 02-26-2010, 10:20 AM
  5. File I/O both ASCII and binary handling in C++
    By random in forum C++ Programming
    Replies: 6
    Last Post: 08-16-2005, 04:53 AM