Home :: International :: Manuals :: Howto :: FAQ :: Man Pages :: Email Login

 
 

 

LSEEK

Section: System calls (2)
Updated: January 17, 1998
Index Return to Main Contents
 

̾Á°

lseek - ¥Õ¥¡¥¤¥ë¤ÎÆÉ¤ß½ñ¤­¥ª¥Õ¥»¥Ã¥È¤Î°ÌÃÖ¤òÊѤ¨¤ë  

½ñ¼°

#include <sys/types.h>
#include <unistd.h>

off_t lseek(int fildes, off_t offset, int whence);  

ÀâÌÀ

lseek ´Ø¿ô¤Ï¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥¿¡¼(descriptor) fildes ¤Î¥ª¥Õ¥»¥Ã¥È¤ò whence ¤Ë½¾¤Ã¤Æ offset °ú¤­¿ô¤Î°ÌÃ֤ذʲ¼¤Î¤è¤¦¤ËÊѹ¹¤¹¤ë:
SEEK_SET
¥ª¥Õ¥»¥Ã¥È¤Ï offset ¥Ð¥¤¥È¤ËÀßÄꤵ¤ì¤ë¡£
SEEK_CUR
¥ª¥Õ¥»¥Ã¥È¤Ï¸½ºß°ÌÃÖ¤Ë offset ¥Ð¥¤¥È¤ò­¤·¤¿Ãͤˤʤ롣
SEEK_END
¥ª¥Õ¥»¥Ã¥È¤Ï¥Õ¥¡¥¤¥ë¤Î¥µ¥¤¥º¤Ë offset ¥Ð¥¤¥È¤ò­¤·¤¿Ãͤˤʤ롣

lseek ´Ø¿ô¤Ï¥ª¥Õ¥»¥Ã¥È¤ò¸ºß¤¹¤ë¥Õ¥¡¥¤¥ë¤Î¥Õ¥¡¥¤¥ë¤ÎºÇ¸å(end-of-file)¤ò ͤ¨¤¿¾ì½ê¤ËÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£¤â¤·¥Ç¡¼¥¿¤¬¤³¤Î»þÅÀ¤è¤ê¸å¤Ë½ñ¤­¹þ¤Þ¤ì¤¿ ¤Ê¤é¤Ð¡¢´Ö¤Î¶õ·ä¤ÎÉôʬ¤òÆÉ¤ß¹þ¤ó¤À¾ì¹ç¤Ï(¼ÂºÝ¤Ë¤½¤³¤Ë¥Ç¡¼¥¿¤ò½ñ¤­¹þ¤à¤Þ¤Ç¤Ï )¥¼¥í¤Î¥Ð¥¤¥ÈÎó¤¬ÊÖ¤µ¤ì¤ë¡£  

ÊÖ¤êÃÍ

À®¸ù¤·¤¿¾ì¹ç¤Ï lseek ¤Ï·ë²Ì¤Î¥Õ¥¡¥¤¥ë°ÌÃÖ¤ò¥Õ¥¡¥¤¥ë¤ÎÀèÆ¬¤«¤é¤Î¥Ð¥¤¥È¿ô¤ÇÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤ì¤Ð ÃͤȤ·¤Æ (off_t)-1 ¤òÊÖ¤·¡¢ errno ¤Ë¥¨¥é¡¼¤¬»Ø¼¨¤µ¤ì¤ë¡£  

¥¨¥é¡¼

EBADF
fildes ¤¬¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¼¤Ç¤Ê¤¤¡£
ESPIPE
fildes ¤¬¥Ñ¥¤¥×(pipe), ¥½¥±¥Ã¥È(socket), FIFO ¤ò»²¾È¤·¤Æ¤¤¤ë¡£
EINVAL
whence ¤¬Àµ¤·¤¤ÃͤǤʤ¤¡£

 

½àµò

SVr4, POSIX, BSD 4.3  

À©¸Â

¤¤¤¯¤Ä¤«¤Î¥Ç¥Ð¥¤¥¹¤Ç¤Ï seek ¤¬¤Ç¤­¤Ê¤¤¡£POSIX ¤Ç¤Ï¤½¤Î¤è¤¦¤Ê ¥Ç¥Ð¥¤¥¹¤Î¥µ¥Ý¡¼¥È¤òÍ׵ᤷ¤Æ¤¤¤Ê¤¤¡£

Linux ÆÃÍ­¤ÎÀ©¸Â¤È¤·¤Æ: tty ¥Ç¥Ð¥¤¥¹¤Ë lseek ¤ò»ÈÍѤ¹¤ë¤È¡¢ ESPIPE ¤òÊÖ¤¹¡£Â¾¤Î¥·¥¹¥Æ¥à¤Ç¤Ï½ñ¤­¹þ¤Þ¤ì¤¿Ê¸»ú¤Î¿ô¤òÊÖ¤·¡¢ SEEK_SET ¤Ç¤½¤Î¥«¥¦¥ó¥¿¡¼¤òÀßÄê¤Ç¤­¤ë¡£¤¤¤¯¤Ä¤«¤Î¥Ç¥Ð¥¤¥¹¡¢Î㤨¤Ð /dev/null ¤Ï ESPIPE ¥¨¥é¡¼¤òµ¯¤³¤µ¤Ê¤¤¤¬¡¢ÊÖ¤µ¤ì¤ë ¥Ý¥¤¥ó¥¿¡¼¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£  

Ãí°Õ

¤³¤Îʸ¾Ï¤Ç»ÈÍѤ·¤¿ whence ¤Ï±Ñ¸ì¤È¤·¤ÆÀµ¤·¤¯¤Ê¤¤¤¬¡¢ Îò»ËŪÍýͳ¤Ë¤è¤ê°Ý»ý¤µ¤ì¤Æ¤¤¤ë¡£

¸Å¤¤¥³¡¼¥É¤òÊÑ´¹¤¹¤ë»þ¤Ï whence ¤ÎÃͤò°Ê²¼¤Î¥Þ¥¯¥í¤ËÃÖ¤­´¹¤¨¤ë¤³¤È:

old new
0SEEK_SET
1SEEK_CUR
2SEEK_END
L_SETSEEK_SET
L_INCRSEEK_CUR
L_XTNDSEEK_END

SVR1-3 ¤Ç¤Ï off_t ¤ÎÂå¤ê¤Ë long ¤òÊÖ¤·¡¢ BSD ¤Ç¤Ï int ¤òÊÖ¤¹¡£  

´ØÏ¢¹àÌÜ

dup(2), open(2), fseek(3)


 

Index

̾Á°
½ñ¼°
ÀâÌÀ
ÊÖ¤êÃÍ
¥¨¥é¡¼
½àµò
À©¸Â
Ãí°Õ
´ØÏ¢¹àÌÜ

 
 
 
 
Google
  Web Linuxinfor   
 

Home :: Copyright :: Privacy :: Credits :: Get a free Linuxinfor Email Account

Document on this page is part of "Linuxinfor Man Pages in HTML Format: man2". See Index Page for more info about Authorship and Copyright.

1999-2008 Linuxinfor.com. No rights reserved.