0
첫 번째 getline (iss, name, ',') 앞에 std :: ignore (1, ',')를 사용하고 'ignore'가이 네임 스페이스에서 선언되지 않았습니다 ' std '.std :: ignore 컴파일러 오류에 대한 설명
if (myfile.is_open()){
98 while (getline (myfile,line)) {
99 //parse line
100 string myText(line);
101 istringstream iss(myText);
102 if(!(iss>>id)) id=0;
103
104 std::ignore(iss,1,',');
105 std::getline(iss,name,',');
106 std::getline(iss,status,',');
107 std::getline(iss,email,',');
108 cout<<name<<endl;
109 Student newStudent(id,name,status,email);
왜 getline 함수가 작동하지만 무시할 수 있습니까?
[documentation] (http://en.cppreference.com/w/cpp/utility/tuple/ignore)을 읽어 보았습니까? 그것은'std :: ignore'가 전혀 없다는 것입니다. – chris
나는 모두 내가 함께 부정확 한 것을 안다. 나는 그것을 잘못 이해했는지 알기 위해 무언가를 시도하고있었습니다. 먼저 std :: ignore (1, ',')를 시도하고 같은 오류가 발생했습니다. 그러나 아래의 대답은 내가 필요한 것입니다. 이 문서는 나를 완전하게 도울 정도로 자세하게 설명하지 않습니다. – user3341518
FWIW, [검색 위치] (http://en.cppreference.com/mwiki/index.php?title=Special%3ASearch&search=ignore&button=)는 대개 꽤 좋습니다. 귀하의 경우에는'std :: istringstream'이 가장 적합하지만 모두 비슷합니다. – chris