fseek in C
File Operations in Tamil
fseek in C
- It is used to move the reading control to different positions using fseek function.
C Syntax
file pointer : It is the pointer which points to the file.
displacement : It is positive or negative. This is the number of bytes which are skipped backward (if negative) or forward( if positive) from the current position. This is attached with L because this is a long integer.
pointer position : This sets the pointer position in the file.
fseek( p,10L,0)
- 0 means pointer position is on beginning of the file, from this statement pointer position is skipped 10 bytes from the beginning of the file.
fseek( p,5L,1)
- 1 means current position of the pointer position. From this statement pointer position is skipped 5 bytes forward from the current position.
fseek(p,-5L,1)
- From this statement pointer position is skipped 5 bytes backward from the current position.
Sample Code
Output
Learn C - C tutorial - C fseek - C examples - C programs