puts, _putws
Visual Studio .NET 2003
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