std::string itself has no problem with null characters. It is truncated when you construct it from a C-style string since null-terminator is how the end of string is recognized. There should be constructors and other methods that also take a count (or a range) and don't rely on the null terminator.
I don't want to use a std::string because that method doesn't seem to work properly (I'm using a filesystem API written in C and some binary files return what appear to be NULL characters despite not having actually reached the end of the file and it seems that std::string truncates itself to the first NULL value it finds breaking the whole system).
(You'd probably use a vector though, when you want to pass a modifiable buffer to functions taking a C-style string by passing the address of the first character. If the API takes const char*, then you can use std::string and just pass c_str().)
const char* str = "hello\0world";
std::string s(str, 11);
std::cout << s << '\n' << s.size() << '\n';