std::ofstream::write adds characters

后端 未结 3 1503
执笔经年
执笔经年 2020-12-30 10:20

I am trying to write binary file using std::ofstream::write method. I found out, that some characters are not written as they are, for example:

         


        
3条回答
  •  旧时难觅i
    2020-12-30 10:47

    You opened the file in text mode and running on Windows. It adds the 0x0d to 0x0a. You need to use binary mode when you create the ofstream instance.

提交回复
热议问题