We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

_putchar_nolock, _putwchar_nolock

Writes a character to stdout without locking the thread.

int _putchar_nolock( 
   int c  
wint_t _putwchar_nolock( 
   wchar_t c  


Character to be written.

See putchar, putwchar.

putchar_nolock and _putwchar_nolock are identical to the versions without the _nolock suffix except that they are not protected from interference by other threads. They might be faster because they do not incur the overhead of locking out other threads. Use these functions only in thread-safe contexts such as single-threaded applications or where the calling scope already handles thread isolation.

Generic-Text Routine Mappings

Tchar.h routine

_UNICODE and _MBCS not defined

_MBCS defined

_UNICODE defined






Required header




<stdio.h> or <wchar.h>

The console is not supported in Windows Store apps. The standard stream handles associated with the console, stdin, stdout, and stderr, must be redirected before C run-time functions can use them in Windows Store apps. For more compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.

// crt_putchar_nolock.c
/* This program uses putchar to write buffer
 * to stdout. If an error occurs, the program
 * stops before writing the entire buffer.

#include <stdio.h>

int main( void )
   FILE *stream;
   char *p, buffer[] = "This is the line of output\n";
   int  ch;

   ch = 0;

   for( p = buffer; (ch != EOF) && (*p != '\0'); p++ )
      ch = _putchar_nolock( *p );

This is the line of output