Writing binary to std::fstream using the << operator

前端 未结 2 945
忘了有多久
忘了有多久 2020-12-07 02:52

For some reason this sort code is not working as I would expect:

std::fstream theFile;
theFile.open(, std::ios::beg |std::ios::out|std::i         


        
2条回答
  •  难免孤独
    2020-12-07 03:15

    The << operator's whole purpose is to write formatted data to a stream. If you want to write binary data, you should use ostream::write() or ostream::put().

提交回复
热议问题