_tscanf_s()와 _tscanf()로 문자열 입력받을 떄??
볼수록매력
2023.04.01
#include stdio.h
#include string.h
#include tchar.h
#include windows.h
#include locale.h
#include ctype.h
#include iso646.h
// ☞ 유니코드 자동으로 정의됐음!
#define STR_LEN 50
int wmain( int argc, wchar_t * argv[ ] )
{
LPSTR string[ STR_LEN ];
_wsetlocale( LC_ALL, _T(korean) );
_fputts( _T(문자열 입력: ), stdout );
_tscanf_s( _T(%s), string ); // 이건 안 됨!
//_tscanf( _T(%s), string ); // 이건 잘 됨!
_tprintf( _T(에코: %s \n), string );
putwchar( 10 );
return 0;
}
--------------------------------------
툴은VC++입니다.
MBCS와 WBCS 버전을 대비한 윈도우즈가 제공하는 함수에서요, _tscanf_s() 함수하고 _tscanf() 함수하고 좀 다른 것 같더라고요. 원래 _tscanf_s() 함수 썼었는데 문자열만 안 되더라고요, 에코를 못합니다. 그래서 문자열 받을 때는 _tscanf() 함수 쓰거든요. 전부터 궁금했는데 이게 왜 그런 겁니까??
-
작약
예..