fork download
  1. #include <algorithm>
  2. #include <iterator>
  3. #include <iostream>
  4. #include <sstream>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. istringstream bytes{ "13 14 15 16 17 18 19 20" };
  10. uint8_t myChars[8];
  11.  
  12. copy(istream_iterator<unsigned short>{ bytes }, istream_iterator<unsigned short>{}, begin(myChars));
  13.  
  14. for(const int i : myChars)
  15. {
  16. cout << i << endl;
  17. }
  18. }
Success #stdin #stdout 0s 4336KB
stdin
Standard input is empty
stdout
13
14
15
16
17
18
19
20