Question

currently I am using a boost char array

boost::array<char, 512> received_data;
std::istringstream ss_(received_data.data()); 

but what if my received_data was a std::vector<char> received_data(512);

how would I then get this data to my std::istringstream ss_?

Was it helpful?

Solution

The istringstream takes a string, and a string can be made from two char iterators, like this:

istringstream iss(string(v.begin(), v.end()));

OTHER TIPS

std::vector<char> receivedData(512);

std::istringstream iss(&receivedData[0]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top