Share via


puts, _putws

Write a string to stdout.

intputs(constchar*string);

int _putws(constwchar_t*string);

Routine Required Header Compatibility
puts <stdio.h> ANSI, Win 95, Win NT
_putws <stdio.h> ANSI, Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

Each of these returns a nonnegative value if successful. If puts fails it returns EOF; if _putws fails it returns WEOF.

Parameter

string

Output string

Remarks

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.

Generic-Text Routine Mappings

TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_putts puts puts _putws

Example

/* PUTS.C: This program uses puts
 * to write a string to stdout.
 */

#include <stdio.h>

void main( void )
{
   puts( "Hello world from puts!" );
}

Output

Hello world from puts!

Stream I/O Routines

See Also   fputs, gets