Is there any way that I can use istringstream to read strings with embedded null characters? For example, if I have a char array "125 320 512 750 333\0 xyz". Is there any way that I could get "xyz" after the null character?
#include <iostream>
#include <sstream>
using namespace std;
int main() {
std::string stringvalues = "125 320 512 750 333\0 xyz";
cout << "val: " << stringvalues << endl;
std::istringstream iss (stringvalues);
for (int n=0; n<10; n++)
{
string val;
iss >> val;
std::cout << val << '\n';
}
return 0;
}
This is an example modified from cplusplus.com. I want to get the part after the null character, and I am curious whether I can get it without knowing the exact length of the char array. Thanks in advance.