Questions tagged [istringstream]

Anything related to C++ `istringstream` standard library class. This class represents an "input string stream", i.e. an input stream that allows a string to be used as the source of information attached to the stream.

Anything related to C++ istringstream standard library class. This class represents an input string stream, i.e. an input stream that allows a string to be used as the source of information attached to the stream.

istringstream is a specialization of the basic_istringstream template class and it is defined in C++ <sstream> standard library header.

See CPPreference.com on basic_istringstream template class.

216 questions
-1
votes
1 answer

Split string by commas using istringstream

I tried this code which can split the string by comma: string spa ="12,233,434,2"; istringstream iss(spa + ","); int val; char dot =','; while(iss >> val >> dot){ cout << val << endl; } But I have no idea how it works. It seems to extract the…
J.ON
  • 11
  • 1
-2
votes
1 answer

in terms of design: overloading the insertion operator for a class member of type vector

Attempting to read from a source file to store person objects into a container. A person object is initialized with a random age, id and a categories vector of five assorted chars. person.hpp class person { protected : int age; // 0 - 99 …
andres
  • 301
  • 6
  • 21
-2
votes
1 answer

C++ - Taking variable number of integers from standard input, n number of times

I'm not able to figure out why the loop in following program is not running exactly testCount times. Please help to make it correct. #include #include #include using namespace std; int main() { size_t testCount; …
Vikas Kaushik
  • 369
  • 2
  • 9
-2
votes
1 answer

istringstream to int8_t produce unexpected result

After read this FAQ, i choose to use istringstream to convert my input string to numerical value. My code is look like this: