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

_cputs, _cputws

Puts a string to the console.

int _cputs( 
   const char *string 
);
int _cputws(
   const wchar_t *string 
);

Parameter

string
Output string.

Return Value

If successful, _cputs returns 0. If the function fails, it returns a nonzero value.

Remarks

The _cputs function writes the null-terminated string pointed to by string directly to the console. A carriage return–line feed (CR-LF) combination is not automatically appended to the string.

Generic-Text Routine Mappings

TCHAR.H routine _UNICODE & _MBCS not defined _MBCS defined _UNICODE defined
_cputts _cputs _cputs _cputws

Requirements

Routine Required header Compatibility
_cputs <conio.h> Win 98, Win Me, Win NT, Win 2000, Win XP
_cputws <conio.h> 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_cputs.c
// compile with: /c
/* This program first displays a string to the console.
 */

#include <conio.h>

int main( void )
{
   // String to print at console. 
   // Note the \r (return) character. 
   char *buffer = "Hello world (courtesy of _cputs)!\r\n";
   wchar_t *wbuffer = L"Hello world (courtesy of _cputws)!\r\n";

   _cputs( buffer );
   _cputws( wbuffer );
}

Output

Hello world (courtesy of _cputs)!
Hello world (courtesy of _cputws)!

See Also

Console and Port I/O Routines | _putch | 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.