puts, _putws
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

puts, _putws

Write a string to stdout.

int puts(
   const char *string 
int _putws(
   const wchar_t *string 


Output string.

Return Value

Returns a nonnegative value if successful. If puts fails, it returns EOF; if _putws fails, it returns WEOF.


The puts function writes string to the standard output stream stdout, replacing the string's terminating null character ('\0') with a newline character ('\n') in the output stream.

Under Windows NT, _putwch writes Unicode characters using the current CONSOLE LOCALE setting.

Generic-Text Routine Mappings

TCHAR.H routine _UNICODE & _MBCS not defined _MBCS defined _UNICODE defined
_putts puts puts _putws


Routine Required header Compatibility
puts <stdio.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP
_putws <stdio.h> ANSI, 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_puts.c
/* This program uses puts to write a string to stdout.

#include <stdio.h>

int main( void )
   puts( "Hello world from puts!" );


Hello world from puts!

See Also

Stream I/O Routines | fputs | gets | Run-Time Routines and .NET Framework Equivalents

© 2016 Microsoft