티스토리 뷰
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형 배열에 입력받을 수도 있다.

'노트' 카테고리의 다른 글
| c++) string stream (0) | 2021.09.16 |
|---|---|
| c++) vector<pair<int,int>> 정렬 (0) | 2021.08.05 |
| git 원격 저장소 (0) | 2021.07.08 |
| c++에서 순열과 조합 구하기 (next_permutation, prev_permutation) (0) | 2021.06.28 |
| DFS를 이용한 순열 만들기 (0) | 2021.06.28 |
- Total
- Today
- Yesterday
- Unity
- Tree
- DP
- Dijkstra
- C
- greedy
- Implementation
- Brute Force
- binary search
- 이분탐색
- Kruskal
- permutation
- 재귀
- graph
- MVC
- floyd warshall
- Stack
- 조합
- db
- Python
- CSS
- recursion
- dfs
- C++
- two pointer
- back tracking
- 자료구조
- BFS
- Spring
- priority queue
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
