The internal file pointer

The internal file pointer, means the place in the file indicating the current location ‚- ie the place in which would start the writing or reading. Most of the functions that operate on files will shift this ratio – every save and read from the file will shift this indicator.

However, you can force a shift – for example, to start reading from a certain place or to skip some piece of data. It is used for this function fseek. The function takes two compulsory and one optional argument. The first parameter is the file pointer – the function needs to know where the file is to move the pointer. The second is the character for which you want to move the pointer. Last specifies the type of shift (possible values ​​are: SEEK_SET, SEEK_CUR and SEEK_END). The default value is SEEK_SET. This means that the internal file pointer is set to the position shift. The setting of the last parameter to SEEK_CURR will cause the file pointer is moved by moving the characters from the current position. In contrast, select the type of SEEK_END cause the rate will be set for a transfer marks the end of the file. There is also a function rewind (int index), which moves the internal file pointer to the beginning of the file.

Close Menu