_cputs, _cputws
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

_cputs, _cputws

Puts a string to the console.

int _cputs( 
   const char *string 
int _cputws(
   const wchar_t *string 


Output string.

Return Value

If successful, _cputs returns 0. If the function fails, it returns a nonzero value.


The _cputs function writes the null-terminated string pointed to by string directly to the console. A carriage return–line feed (CR-LF) combination is not automatically appended to the string.

Generic-Text Routine Mappings

TCHAR.H routine _UNICODE & _MBCS not defined _MBCS defined _UNICODE defined
_cputts _cputs _cputs _cputws


Routine Required header Compatibility
_cputs <conio.h> Win 98, Win Me, Win NT, Win 2000, Win XP
_cputws <conio.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.


// crt_cputs.c
// compile with: /c
/* This program first displays a string to the console.

#include <conio.h>

int main( void )
   // String to print at console. 
   // Note the \r (return) character. 
   char *buffer = "Hello world (courtesy of _cputs)!\r\n";
   wchar_t *wbuffer = L"Hello world (courtesy of _cputws)!\r\n";

   _cputs( buffer );
   _cputws( wbuffer );


Hello world (courtesy of _cputs)!
Hello world (courtesy of _cputws)!

See Also

Console and Port I/O Routines | _putch | Run-Time Routines and .NET Framework Equivalents

© 2016 Microsoft