_putchar_nolock、_putwchar_nolock

写入stdout 中的字符不锁定线程。

int _putchar_nolock( 
   int c  
); 
wint_t _putwchar_nolock( 
   wchar_t c  
);

参数

  • c
    要写入的字符。

返回值

请参见 putchar, putwchar

备注

对于没有**_nolock后缀的版本putchar_nolock** 和 _putwchar_nolock是相同的,但它们不由其他线程防止干扰。 它们可能更快,因为它们不会产生锁定其他线程的开销。 仅在线程安全的上下文中使用这些函数,如单线程应用程序或调用范围已经处理线程隔离。

一般文本例程映射

Tchar.h 例程

未定义 _UNICODE 和 _MBCS

已定义 _MBCS

已定义 _UNICODE

_puttchar_nolock

_putchar_nolock

_putchar_nolock

_putwchar_nolock

要求

例程

必需的标头

_putchar_nolock

<stdio.h>

_putwchar_nolock

<stdio.h> 或 <wchar.h>

控制台在 Windows 应用商店 应用程序中不受支持。 与控制台 stdin、stdout 和 stderr 关联的标准流句柄必须重定向,然后 C 运行时函数才可以在 Windows 应用商店 应用程序中使用它们。 有关兼容性的更多信息,请参见兼容性

C 运行时库的所有版本。

示例

// 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 );
}

Output

This is the line of output

.NET Framework 等效项

请参见

参考

流 I/O

fputc、fputwc

fgetc、fgetwc