Jump to content
Tuts 4 You
Sign in to follow this  

Easy way to write chars to file?

Recommended Posts


By default ofstream treats the file as text file, so 0x0A will be transformed to 0x0d, 0x0a. You have to open you file in binary mode.

ofstream out("D:\\block1", ios::binary);
out.write((char *) &block1Conv, sizeof block1Conv);   



Edited by Ahmad_k (see edit history)
  • Like 1
  • Thanks 1

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Create New...