Share via


_fgetc_nolock, _fgetwc_nolock

lee un carácter de una secuencia sin bloquear el subproceso.

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

Parámetros

  • stream
    puntero a la estructura de FILE .

Valor devuelto

Veafgetc, fgetwc.

Comentarios

_fgetc_nolock y _fgetwc_nolock son idénticos a fgetc y a fgetwc, respectivamente, salvo que no se protegen de interferencia por otros subprocesos.Éste puede ser más rápida porque contiene no incurre en la sobrecarga de bloquear out otros subprocesos.Utilice estas funciones solo en contextos seguros como aplicaciones de un único subproceso o donde los identificadores de ámbito de llamada subproceso ya el aislamiento.

Asignaciones de la rutina de texto genérico

rutina de Tchar.h

_UNICODE y _MBCS no definido

_MBCS definido

_UNICODE definido

_fgettc_nolock

_fgetc_nolock

_fgetc_nolock

_fgetwc_nolock

Requisitos

Función

Encabezado necesario

_fgetc_nolock

<stdio.h>

_fgetwc_nolock

<stdio.h> o <wchar.h>

Para obtener más información de compatibilidad, vea compatibilidad en la Introducción.

Ejemplo

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

entrada: crt_fgetc_nolock.txt

Line one.
Line two.

4w22te48.collapse_all(es-es,VS.110).gifOutput

Line one.
Line two.

Equivalente en .NET Framework

Vea también

Referencia

E/S de la secuencia

fputc, fputwc

getc, getwc