Jump to content
Tuts 4 You
CodeExplorer

Easy way to write chars to file?

Recommended Posts

Ahmad_k

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);   
out.close(); 

 

Untitled.png

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

Share this post


Link to post
Share on other sites

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

×