|
|
I'v been getting this message since forever "no matching member function for call to get". That's why I couldn't use it. |
|
|
|
|
length: 6 buf: 736473 int: 736473 length: 6 buf: 648632 int: 648632 length: 6 buf: 423846 int: 423846 length: 6 buf: 253476 int: 253476 length: 6 buf: 325432 int: 325432 length: 6 buf: 434342 int: 434342 length: 5 buf: 34234 int: 34234 |
#include <iostream> #include <sstream> #include <iomanip> using namespace std; int main() { std::string input = "73647364863242384625347632543243434234234"; std::string output; int num; std::istringstream ins(input); while(ins >> setw(6) >> output) // Extract 6 characters from the stream. { std::istringstream sin(output); sin >> num; cout << "output:" << setw(7) << output << " length: " << output.length() << " num:" << setw(7) << num << endl; } } |