共用方式為


_putc_nolock _putwc_nolock

寫入資料至一個字元,而不用鎖定的執行緒。

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

參數

  • c
    要寫入的字元。

  • stream
    對檔案結構的指標。

傳回值

請參閱 putc, putwc

備註

_putc_nolock 和 _putwc_nolock 與版本相同沒有 _nolock 後置字元,但不會防止由其他執行緒的功能。 因為它們不會造成額外負荷鎖定其他執行緒,可能會比較快。 在安全執行緒內容中只使用這些函式 (例如單一執行緒應用程式呼叫或的範圍控制代碼已經執行緒隔離的地方。

_putwc_nolock 是 _putc_nolock的寬字元版本;資料流,則在 ANSI 模式中,開啟兩個函式的作用完全相同。 _putc_nolock 目前不支援輸出到 UNICODE 串流。

泛用文字常式對應

Tchar.h 常式

未定義的 _UNICODE 和 _MBCS

已定義 _MBCS

已定義 _UNICODE

_puttc_nolock

_putc_nolock

_putc_nolock

_putwc_nolock

需求

程序

必要的標頭檔

_putc_nolock

<stdio.h>

_putwc_nolock

<stdio.h> 或 <wchar.h>

主控台 Windows 市集 應用程式不支援。 標準資料流控制代碼與主控台, stdin, stdout和 stderr,在這種情況下, C 執行階段函式在 Windows 市集 應用程式之前,可以使用它們必須重新導向。 如需更多關於相容性的資訊,請參閱入門介紹中的 相容性 (Compatibility)

程式庫

所有的 C 執行階段程式庫 (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 );
}

Output

This is the line of output

.NET Framework 對等用法

請參閱

參考

資料流 I/O

fputc fputwc

getc getwc