25 Linux下的off_t类型

off_t类型用于指示文件的偏移量,常就是long类型,其默认为一个32位的整数,在gcc编译中会被编译为long int类型,在64位的Linux系统中则会被编译为long long int,这是一个64位的整数,其定义在unistd.h头文件中可以查看。


 242 # ifndef __off_t_defined
243 #  ifndef __USE_FILE_OFFSET64
244 typedef __off_t off_t;
245 #  else
246 typedef __off64_t off_t;
247 #  endif
248 #  define __off_t_defined
249 # endif
250 # if defined __USE_LARGEFILE64 && !defined __off64_t_defined
251 typedef __off64_t off64_t;
252 #  define __off64_t_defined
253 # endif



329 /* Move FD‘s file position to OFFSET bytes from the
330    beginning of the file (if WHENCE is SEEK_SET),
331    the current position (if WHENCE is SEEK_CUR),
332    or the end of the file (if WHENCE is SEEK_END).
333    Return the new file position.  */
334 #ifndef __USE_FILE_OFFSET64
335 extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW;
336 #else
337 # ifdef __REDIRECT_NTH
338 extern __off64_t __REDIRECT_NTH (lseek,
339                                  (int __fd, __off64_t __offset, int __whence),
340                                  lseek64);
341 # else
342 #  define lseek lseek64
343 # endif
344 #endif
345 #ifdef __USE_LARGEFILE64
346 extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence)
347      __THROW;
348 #endif

25 Linux下的off_t类型,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。