Unlike scanf and wscanf, scanf_s and wscanf_s require the buffer size to be specified for all input parameters of type c, C, s, S, or [. The buffer size in characters is passed as an additional parameter immediately following the pointer to the buffer or variable. For example, if reading a string, the buffer size for that string is passed as follows:
질문은 프갤로 - dc App
scanf_s를 버리십쇼. 그러면 에러가 뜰텐데 그거 끄는 법은 검색하면 나올거
define 노 워닝 하면 되는거 맞습니까?
오 이러니까 되네요 왜 스캔에프에스쓰면 안되는 건가요? 이것땜에 몇시간을 헤맸네
scanf_s("%c", &ch, 1);
scanf_s는 입력받을 길이를 명시해줘야 함
지금까지 다른 int로 정의된 변수에서는 문제가 없었는데 왜 여기서만 걸리는건가요?
Unlike scanf and wscanf, scanf_s and wscanf_s require the buffer size to be specified for all input parameters of type c, C, s, S, or [. The buffer size in characters is passed as an additional parameter immediately following the pointer to the buffer or variable. For example, if reading a string, the buffer size for that string is passed as follows:
https://docs.microsoft.com/ko-kr/cpp/c-runtime-library/reference/scanf-s-scanf-s-l-wscanf-s-wscanf-s-l?view=vs-2019
MSDN
문서를 찾아보면 좋음
감사합니다ㅠ
이거 보안문제 생겨서 그런거. scanf 이용한 메모리 공격이 가능해서.
빌게이츠가 또 한건을 해내네
말머리좀
getc, getch, read 이런 함수로도 stdin 읽을 수 있음
그리고 unsigned char 로 받으면 되구.