std::string equivalent for data with null characters?

前端 未结 5 1175
梦谈多话
梦谈多话 2021-01-13 18:57

I\'d like to read a binary file and use something like std::string that automatically resizes the buffer and such.

I\'m using Visual C++. What are my op

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-13 19:43

    The std::string class already does handle data with embedded NUL characters. What problem are you encountering?

    Note that when using the .c_str() method, any embedded NUL character will terminate the returned C-style string.

提交回复
热议问题