I'm trying to read in multiple paragraphs from the input and storing them as a vector of strings. They are separated by empty strings. I wrote the code below but I keep running into a SIGPIPE error. Can anyone tell me why?
getline(cin, num_stores);
vector<string> test;
while(cin.eof() == false){
ostringstream ss;
string line;
while((getline(cin, line)) && (line.size() != 0)){
ss << line << endl;
}
string paragraph = ss.str();
test.push_back(paragraph);
if(cin.eof() == true){
break;
}
}
Please login or Register to submit your answer