c++) getline 함수, char형 배열에 입력받기
https://www.geeksforgeeks.org/getline-function-character-array/
getline() function and character array - GeeksforGeeks
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
www.geeksforgeeks.org
- getline() function reads whole line of text that ends with new line or until the maximum limit is reached
-> getline() 함수는 개행문자 혹은 maximum limit 를 만날때까지 입력을 받는다
getline() 함수의 작동원리는
입력받은 input에서 character를 추출해서 append 한다. 이 과정은 다음 중 한가지가 발생할때까지 반복된다.
a) end-of-file을 만났을때
b) 추출한 char가 delimiter일때
c) str.max_size()의 character가 저장되었을 때
일반적으로 getline() 함수는 이렇게 쓰인다
그런데 다음과 같이 char형 배열에 입력받을 수도 있다.