Chinaunix首页 | 论坛 | 博客
  • 博客访问: 132490
  • 博文数量: 75
  • 博客积分: 1485
  • 博客等级: 上尉
  • 技术积分: 720
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-11 20:57
文章分类
文章存档

2011年(1)

2010年(15)

2009年(59)

我的朋友

分类: LINUX

2009-10-14 14:08:23

Data Type: size_t

This is an unsigned integer type used to represent the sizes of objects. The result of the sizeof operator is of this type, and functions such as malloc (see ) and memcpy (see ) accept arguments of this type to specify object sizes.

 
Data Type: ssize_t
This data type is used to represent the sizes of blocks that can be read or written in a single operation. It is similar to size_t, but must be a signed type.

Function: ssize_t read (int filedes, void *buffer, size_t size)
The read function reads up to size bytes from the file with descriptor filedes, storing the results in the buffer. (This is not necessarily a character string, and no terminating null character is added.)

The return value is the number of bytes actually read. This might be less than size; for example, if there aren't that many bytes left in the file or if there aren't that many bytes immediately available. The exact behavior depends on what kind of file it is. Note that reading less than size bytes is not an error.

A value of zero indicates end-of-file (except if the value of the size argument is also zero). This is not considered an error. If you keep calling read while at end-of-file, it will keep returning zero and doing nothing else.

If read returns at least one character, there is no way you can tell whether end-of-file was reached. But if you did reach the end, the next read will return zero.

In case of an error, read returns -1.

阅读(750) | 评论(0) | 转发(0) |
0

上一篇:int _init void _exit

下一篇:生日

给主人留下些什么吧!~~