_fgetc_nolock, _fgetwc_nolock

잠금 없이 스트림에서 문자를 읽습니다.

구문

int _fgetc_nolock(
   FILE *stream
);
wint_t _fgetwc_nolock(
   FILE *stream
);

매개 변수

stream
FILE 구조체에 대한 포인터입니다.

반환 값

fgetc, fgetwc를 참조하세요.

설명

_fgetc_nolock_fgetwc_nolock 함수는 다른 스레드의 간섭으로부터 보호되지 않는다는 점을 제외하고 fgetcfgetwc와 동일합니다. 이들은 다른 스레드를 잠그는 오버헤드를 유발하지 않으므로 속도가 더 빠를 수 있습니다. 단일 스레드 애플리케이션과 같은 스레드로부터 안전한 컨텍스트 또는 이미 스레드 격리를 처리한 호출 범위에서만 이러한 함수를 사용합니다.

기본적으로 이 함수의 전역 상태는 애플리케이션으로 범위가 지정됩니다. 이 동작을 변경하려면 CRT 전역 상태를 참조하세요.

일반 텍스트 루틴 매핑

Tchar.h 루틴 _UNICODE_MBCS 정의되지 않음 정의된 _MBCS 정의된 _UNICODE
_fgettc_nolock _fgetc_nolock _fgetc_nolock _fgetwc_nolock

요구 사항

함수 필수 헤더
_fgetc_nolock <stdio.h>
_fgetwc_nolock <stdio.h> 또는 <wchar.h>

호환성에 대한 자세한 내용은 호환성을 참조하세요.

예시

// crt_fgetc_nolock.c
// This program uses getc to read the first
// 80 input characters (or until the end of input)
// and place them into a string named buffer.

#include <stdio.h>
#include <stdlib.h>

int main( void )
{
   FILE *stream;
   char buffer[81];
   int  i, ch;

   // Open file to read line from:
   if( fopen_s( &stream, "crt_fgetc_nolock.txt", "r" ) != 0 )
      exit( 0 );

   // Read in first 80 characters and place them in "buffer":
   ch = fgetc( stream );
   for( i=0; (i < 80 ) && ( feof( stream ) == 0 ); i++ )
   {
      buffer[i] = (char)ch;
      ch = _fgetc_nolock( stream );
   }

   // Add null to end string
   buffer[i] = '\0';
   printf( "%s\n", buffer );
   fclose( stream );
}

입력: crt_fgetc_nolock.txt

Line one.
Line two.

출력

Line one.
Line two.

참고 항목

스트림 I/O
fputc, fputwc
getc, getwc