Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

puts, _putws

Write a string to stdout.

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

Parameter

string
Output string.

Return Value

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

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.

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

Requirements

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.

Libraries

All versions of the C run-time libraries.

Example

// crt_puts.c
/* This program uses puts to write a string to stdout.
 */

#include <stdio.h>

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

Output

Hello world from puts!

See Also

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.