Exemplo n.º 1
0
int _PDCLIB_fgetc_unlocked( FILE * stream )
{
    if ( _PDCLIB_prepread( stream ) == EOF )
    {
        return EOF;
    }

    char c;

    size_t n = _PDCLIB_getchars( &c, 1, EOF, stream );

    return n == 0 ? EOF : (unsigned char) c;
}
Exemplo n.º 2
0
char * gets( char * s )
{
    if ( _PDCLIB_prepread( stdin ) == EOF )
    {
        return NULL;
    }
    char * dest = s;
    while ( ( *dest = stdin->buffer[stdin->bufidx++] ) != '\n' )
    {
        ++dest;
        if ( stdin->bufidx == stdin->bufend )
        {
            if ( _PDCLIB_fillbuffer( stdin ) == EOF )
            {
                break;
            }
        }
    }
    *dest = '\0';
    return ( dest == s ) ? NULL : s;
}