write and read string to binary file C++

后端 未结 7 753
暖寄归人
暖寄归人 2020-12-09 12:46

Im having problems writing string into a binary file. This is my code:

ofstream outfile(\"myfile.txt\", ofstream::binary);
std::string text = \"Text\";
outfi         


        
相关标签:
7条回答
  • 2020-12-09 13:33

    Should probably also use c_str() to get the char pointer too, instead of that straight crazy cast.

    0 讨论(0)
提交回复
热议问题