码迷,mamicode.com
首页 > 其他好文 > 详细

read函数

时间:2014-07-28 23:56:34      阅读:548      评论:0      收藏:0      [点我收藏+]

标签:des   style   color   os   文件   io   for   art   

       #include <unistd.h>

       ssize_t read(int fd, void *buf, size_t count);

DESCRIPTION
       read()  attempts  to  read  up  to count bytes from file descriptor fd into the
       buffer starting at buf.

       If count is zero, read() returns zero and has no other results.   If  count  is
       greater than SSIZE_MAX, the result is unspecified.

RETURN VALUE
       On  success, the number of bytes read is returned (zero indicates end of file;0表示到了文件的末尾),
       and the file position is advanced by this number.  It is not an error  if  this
       number is smaller than the number of bytes requested; this may happen for exam-
       ple because fewer bytes are actually available right now (maybe because we were
       close  to  end-of-file, or because we are reading from a pipe, or from a termi-
       nal), or because read() was interrupted by a signal.  On error, -1 is returned,
       and  errno  is  set appropriately.  In this case it is left unspecified whether
       the file position (if any) changes.

read函数,布布扣,bubuko.com

read函数

标签:des   style   color   os   文件   io   for   art   

原文地址:http://www.cnblogs.com/flying06/p/3873374.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!