[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  FSEEK

  .  Summary

  fseek(int <fh>, int <offset>, int <origin>);

  .  Description

  The fseek function sets the position of the file pointer in the file
  represented by the file handle <fh>. The file position is where the
  next read or write will take place. <offset> is the signed offset
  from the location specified by <origin>. Legal values for <origin>
  are:

       0:   Beginning of file.
       1:   Current position.
       2:   End of file.

  The pointer can be positioned anywhere in the file, and even past
  the end of the file (which will extend it). It is illegal to try to
  position the pointer before the beginning of the file however.

  .  Return Value

  If successful, fseek returns a 0 value, otherwise a non-zero value
  is returned.

  .  Example

  int f;
  f = fopen("test.dat", "r");
  fseek(f, 0, 0);       // go to offset 0 in file
  fseek(f, 1000, 0);    // go to offset 1000 in file
  fseek(f, -5, 1);      // go back 5 places in file
  fseek(f, 0, 2);       // go to the end of the file

See Also: ftell
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson