[prev] [index] [next]

The fseek function (cont)

Examples of fseek() usage:

FILE *fp;  // open for reading and/or writing

// move cursor to start of file (rewind)
fseek(fp, 0L, SEEK_SET);

// move cursor to end of file
fseek(fp, 0L, SEEK_END);

// backup one byte in file
fseek(fp, -1L, SEEK_CUR);

For a more extensive example:
testseek.c