#include <iostream>
#include <string>

int main() {
    std::string x("foo\0bar", 7);
    
    for (std::string::iterator i = x.begin(); i != x.end(); ++i) {
        std::cout << std::hex << static_cast<int>(*i) << std::endl;
    }
}