Category : getline

Can someone tell me what am I doing wrong? I wrote this: char name[MAX_NAME_LEN]; cout << "Insert your name: "; cin.getline(name, MAX_NAME_LEN, ‘n’); and then if the input was bigger than 15 characters and I ask for another input, it will instantly use the previous input. Thanks Source: Windows Que..

Read more

This is my funcoes.h where i keep my fuctions, my problem is at this line cout << "Digite o tipo de EPI a ser cadastrado: n"; My program just skips the next getline(); and i cannot read user input. looks like this The next getline() is working fine, so i’ve no ideia where the problem ..

Read more

I need to use two types of getline in my program. First: template<> std::istream &std::getline<char, std::char_traits<char>, std::allocator<char>>(std::istream &__is, std::__cxx11::string &__str, char __delim) +4 overloads Read a line from an rvalue stream into a string. which I use for In a while condition. getline(strstrm, field,’,’) where: string line, field, temp; stringstream strstrm(line); But now When I ..

Read more

Question – Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a closing curved bracket at the end of the ..

Read more

I’m trying to read a CSV file, the problem is that every time the program reads a line and tries to split it by commas, it apparently skips the first token. Why is this? void readCSV(string path) { ifstream file; string line, cell; stringstream ss; file.open(path); if (file.fail()) { throw runtime_error("Cannot read file"); } while ..

Read more