Export (0) Print
Expand All
div
eof
Expand Minimize

puts, _putws 

Write a string to stdout.


int puts(
   const char *str 
);
int _putws(
   const wchar_t *str 
);

Parameters

str

Output string.

Returns a nonnegative value if successful. If puts fails, it returns EOF; if _putws fails, it returns WEOF. If str is a null pointer, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, the functions set errno to EINVAL and return EOF or WEOF.

For information on these and other error codes, see _doserrno, errno, _sys_errlist, and _sys_nerr.

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

_putws is the wide-character version of puts; the two functions behave identically if the stream is opened in ANSI mode. puts doesn't currently support output into a UNICODE 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, Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

_putws

<stdio.h>

ANSI, Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For additional compatibility information, see Compatibility in the Introduction.

Libraries

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!

Community Additions

ADD
Show:
© 2014 Microsoft