Lseek () has a special purpose for determining whether a file is a regular file or a device.
<pre lang= "C" escaped= "true" >
off_t Currpos;
Ourrpos = Lseek (FD, 0, seek_cur);
if (Ourrpos = =-1)
{
printf ("This was drive file");
}
</pre>
This method is used to determine whether the file or device can set the offset, the regular file can set the offset, and the device is generally not to set the offset, if the device does not support Lseek (), then Lseek returns 1, and the errno device is espipe.
<pre lang= "C" escaped= "true" >
#include <sys/types.h>
#include <unistd.h>
off_t lseek (int fd, off_t offset, int whence);
DESCRIPTION
The Lseek () function repositions The offset of the open file associated with the file descriptor fd to the argument offset According to the directive whence as
follows:
Seek_set
The offset is set to offset bytes.
Seek_cur
The offset is a set to their current location plus offset bytes.
Seek_end
The offset is set to the size of the file plus offset bytes.
</pre>
Lseek () function