Back to index

glibc  2.9
Functions
iofsetpos.c File Reference
#include <libioP.h>
#include <errno.h>
#include <shlib-compat.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int _IO_new_fsetpos (_IO_FILE *fp, const _IO_fpos_t *posp)

Function Documentation

int _IO_new_fsetpos ( _IO_FILE fp,
const _IO_fpos_t posp 
)

Definition at line 34 of file iofsetpos.c.

{
  int result;
  CHECK_FILE (fp, EOF);
  _IO_acquire_lock (fp);
  if (_IO_seekpos_unlocked (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
      == _IO_pos_BAD)
    {
      /* ANSI explicitly requires setting errno to a positive value on
        failure.  */
#ifdef EIO
      if (errno == 0)
       __set_errno (EIO);
#endif
      result = EOF;
    }
  else
    {
      result = 0;
      if (fp->_mode > 0
         && (*fp->_codecvt->__codecvt_do_encoding) (fp->_codecvt) < 0)
       /* This is a stateful encoding, restore the state.  */
       fp->_wide_data->_IO_state = posp->__state;
    }
  _IO_release_lock (fp);
  return result;
}

Here is the call graph for this function: