コード例 #1
0
ファイル: fsetpos.c プロジェクト: Rudster816/wnos
int fsetpos( struct _PDCLIB_file_t * stream, const struct _PDCLIB_fpos_t * pos )
{
    if ( stream->status & _PDCLIB_FWRITE )
    {
        if ( _PDCLIB_flushbuffer( stream ) == EOF )
        {
            return EOF;
        }
    }
    if ( _PDCLIB_seek( stream, pos->offset, SEEK_SET ) == EOF )
    {
        return EOF;
    }
    stream->pos.status = pos->status;
    /* TODO: Add mbstate. */
    return 0;
}
コード例 #2
0
ファイル: fsetpos.c プロジェクト: Bigcheese/nucleo-toolchain
int _PDCLIB_fsetpos_unlocked( FILE * stream, 
                      const _PDCLIB_fpos_t * pos )
{
    if ( stream->status & _PDCLIB_FWRITE )
    {
        if ( _PDCLIB_flushbuffer( stream ) == EOF )
        {
            return EOF;
        }
    }
    if ( _PDCLIB_seek( stream, pos->offset, SEEK_SET ) == EOF )
    {
        return EOF;
    }
    stream->pos.mbs = pos->mbs;
    
    return 0;
}
コード例 #3
0
ファイル: fseek.c プロジェクト: kubasz/NovuOS
int _PDCLIB_fseek_unlocked( FILE * stream, long loffset, int whence )
{
    _PDCLIB_int64_t offset = loffset;
    if ( stream->status & _PDCLIB_FWRITE )
    {
        if ( _PDCLIB_flushbuffer( stream ) == EOF )
        {
            return EOF;
        }
    }
    stream->status &= ~ _PDCLIB_EOFFLAG;
    if ( stream->status & _PDCLIB_FRW )
    {
        stream->status &= ~ ( _PDCLIB_FREAD | _PDCLIB_FWRITE );
    }

    if ( whence == SEEK_CUR )
    {
        whence  = SEEK_SET;
        offset += _PDCLIB_ftell64_unlocked( stream );
    }

    return ( _PDCLIB_seek( stream, offset, whence ) != EOF ) ? 0 : EOF;
}