Use getline and istringstream:
#include <sstream>
/*....*/
vector<int> getclause() {
char c;
vector<int> cl;
std::string line;
std::getline(cin, line);
std::istringstream iss(line);
while ( iss >> c) {
cl.push_back(c);
}
return cl;
}
More Related Contents:
- C++ if statement/xcode [closed]
- Reading garbage instead of segfault for non-existant memory locations
- Why data cast is not working here in c++?
- What are the evaluation order guarantees introduced by C++17?
- std::string formatting like sprintf
- Is Meyers’ implementation of the Singleton pattern thread safe?
- Difference of keywords ‘typename’ and ‘class’ in templates?
- Is ncurses available for windows? [closed]
- How to create a thread pool using boost in C++?
- How to get the MD5 hash of a file in C++? [closed]
- How to get available memory C++/g++?
- Understanding std::hardware_destructive_interference_size and std::hardware_constructive_interference_size
- std::array vs array performance
- Why use functors over functions?
- Access variable value using string representing variable’s name in C++ [duplicate]
- Implementing SSE 4.2’s CRC32C in software
- boost spirit semantic action parameters
- What are the signs of crosses initialization?
- Enumerate over an enum in C++
- Does delete on a pointer to a subclass call the base class destructor?
- Why is std::unordered_map slow, and can I use it more effectively to alleviate that?
- C++ equivalent of sprintf?
- If I do a `typedef` in C or C++, when should I add `_t` at the end of typedef’ed type? [duplicate]
- Better shading on BW display while rendering filled surfaces
- How to use profile guided optimizations in g++?
- Performance of qsort vs std::sort?
- How do I erase elements from STL containers?
- error: ‘INT32_MAX’ was not declared in this scope
- Optimizations for pow() with const non-integer exponent?
- Const and non const template specialization