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

_putc_nolock, _putwc_nolock 

Writes a character to a stream without locking the thread.


int _putc_nolock(
   int c,
   FILE *stream 
);
wint_t _putwc_nolock(
   wchar_t c,
   FILE *stream 
);

Parameters

c

Character to be written.

stream

Pointer to the FILE structure.

See putc, putwc.

_putc_nolock and _putwc_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.

_putwc_nolock is the wide-character version of _putc_nolock; the two functions behave identically if the stream is opened in ANSI mode. _putc_nolock doesn't currently support output into a UNICODE stream.

Generic-Text Routine Mappings
Tchar.h routine _UNICODE and _MBCS not defined _MBCS defined _UNICODE defined

_puttc_nolock

_putc_nolock

_putc_nolock

_putwc_nolock

Routine Required header Compatibility

_putc_nolock

<stdio.h>

ANSI, Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

_putwc_nolock

<stdio.h> or <wchar.h>

ANSI, Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For more compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

// crt_putc_nolock.c
/* This program uses putc to write buffer
 * to a stream. 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;
   /* Make standard out the stream and write to it. */
   stream = stdout;
   for( p = buffer; (ch != EOF) && (*p != '\0'); p++ )
      ch = _putc_nolock( *p, stream );
}
This is the line of output
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.