_cputs, _cputws
콘솔에 문자열을 배치합니다.
![]() |
---|
이 API를 실행 하는 응용 프로그램에서 사용할 수 있는 Windows 런타임.자세한 내용은 /zw에 지원 되는 CRT 함수. |
int _cputs( const char *str ); int _cputws( const wchar_t *str );
매개 변수
- str
출력 문자열입니다.
반환 값
성공 하면 _cputs 0을 반환 합니다.함수가 실패 하면 0이 아닌 값을 반환 합니다.
설명
_cputs 함수 가리킵니다 null로 끝나는 문자열을 씁니다 str 콘솔에 직접.캐리지 리턴-줄 바꿈 (CR-LF) 조합 문자열을 자동으로 추가 되지 않습니다.
이 함수는 매개 변수를 확인합니다.경우 str 는 NULL에 설명 된 대로 잘못 된 매개 변수 처리기를 호출 매개 변수 유효성 검사.실행을 계속 하려면 허용 되는 경우 errno 로 설정 된 EINVAL 가-1을 반환 합니다.
일반 텍스트 루틴 매핑
Tchar.h 루틴 |
_UNICODE 및 _mbcs가 정의 되어 있지 않습니다 |
_Mbcs가 정의 |
_Unicode가 정의 |
---|---|---|---|
_cputts |
_cputs |
_cputs |
_cputws |
요구 사항
루틴 |
필수 헤더 |
선택적 헤더 |
---|---|---|
_cputs |
<conio.h> |
<errno.h> |
_cputws |
<conio.h> |
<errno.h> |
자세한 호환성에 대한 내용은 호환성.
라이브러리
모든 버전의 C 런타임 라이브러리.
예제
// crt_cputs.c
// compile with: /c
// This program first displays a string to the console.
#include <conio.h>
#include <errno.h>
void print_to_console(char* buffer)
{
int retval;
retval = _cputs( buffer );
if (retval)
{
if (errno == EINVAL)
{
_cputs( "Invalid buffer in print_to_console.\r\n");
}
else
_cputs( "Unexpected error in print_to_console.\r\n");
}
}
void wprint_to_console(wchar_t* wbuffer)
{
int retval;
retval = _cputws( wbuffer );
if (retval)
{
if (errno == EINVAL)
{
_cputws( L"Invalid buffer in wprint_to_console.\r\n");
}
else
_cputws( L"Unexpected error in wprint_to_console.\r\n");
}
}
int main()
{
// String to print at console.
// Notice the \r (return) character.
char* buffer = "Hello world (courtesy of _cputs)!\r\n";
wchar_t *wbuffer = L"Hello world (courtesy of _cputws)!\r\n";
print_to_console(buffer);
wprint_to_console( wbuffer );
}
Output
Hello world (courtesy of _cputs)!
Hello world (courtesy of _cputws)!