fork download
  1. #include <vector>
  2. #include <string>
  3. #include <iterator>
  4. #include <iostream>
  5.  
  6. std::vector<char *> fabricate(std::vector<std::string> & v)
  7. {
  8. std::vector<char *> res(v.size() + 1, NULL);
  9. for (std::size_t i = 0; i != v.size(); ++i) { res[i] = &v[i][0]); }
  10. return res;
  11. }
  12.  
  13. std::vector<std::string> args_vector((std::istream_iterator<std::string>(std::cin)), std::istream_iterator<std::string>());
  14.  
  15. std::vector<char *> argv_vector = fabricate(args_vector);
  16.  
  17.  
  18. int main(int argc, char * argv[])
  19. {
  20. argc = args_vector.size();
  21. argv = argv_vector.data();
  22.  
  23. // ...
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
ashok baktha
compilation info
prog.cpp: In function ‘std::vector<char*, std::allocator<char*> > fabricate(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)’:
prog.cpp:9: error: expected `;' before ‘)’ token
stdout

Standard output is empty