[개념 정리] cin.getline() vs getline(), 둘의 차이점?


[개념 정리] cin.getline() vs getline(), 둘의 차이점?

C++ 언어를 이용해서 코딩을 진행하다 보니 cin.getline, getline 이름이 같은 두 함수를 사용할 때마다 헷갈려서 정확한 차이점을 한 번 정리하도록 하겠습니다. 우선 C++ 공식 문서에서 두 함수의 정의를 읽어봤습니다. 1. cin.getline(char *s, streamsize n) Extracts characters from the stream as unformatted input and stores them into s as c-string, until either the extracted character is the delimiting character, or n characters have been written to s (including the terminating null character). delimiting character를 만나거나 n 개의 문자를 입력받을 때까지 정형화되지 않은 입력의 흐름으로부터 문자열을 추출하고 c-string type의...


#C #cin #cpp #getline #기본개념 #코딩공부

원문링크 : [개념 정리] cin.getline() vs getline(), 둘의 차이점?