linux文件操作函数

一  文件操作函数(Unix I/O:不带缓冲):注意相关命令。

(1)open和create函数:open and possible create a file or device。

(2)close函数:close a file descriptor。

(3)lseek函数:reposition read/write file offset。

(4)read函数:read from a file descriptor。

(5)write函数:write to a file descriptor。

(6)dup、dup2、dup3函数:duplicate a file descriptor。

(7)fcntl函数:改变已打开文件的性质。

(8)ioctl函数:不能用其他I/O函数表示的操纵,基本上都可以用ioctl完成。

(9)stat、fstat、lstat函数:获取文件的状态信息,包括:文件类型、大小、拥有者、访问权限、最后访问和修改时间等信息。

(10)access函数:check real user's permissions for a file.

(11)umask函数:设置调用进程的文件创建屏蔽字。

(12)chmod和fchmod函数:change permissions of a file。

(13)chown、fchown和lchown:change ownership of  a file。

(14)truncate和ftruncate函数:truncate a file to specified length。

(15)utime函数:更改文件的访问时间和修改时间。


二 目录操作函数:

(1)link函数:create a new link(also know as a hard link) to an existing file。

(2)symlink函数:创建一个符号链接。

(3)readlink函数:read value of a symbolic link。

(4)unlink函数:deletes a name from the file system.

(5)remove函数:deletes a name from the file system. It calls unlink for files,and rmdir for directories.

(6)rename函数:renames a file,moving it between directories if required.

(7)mkdir函数:创建一个目录。

(8)rmdir函数:删除一个目录。

(9)opendir和fdopendir函数:打开一个目录。

(10)readdir和readdir_r函数:读取一个目录。

(11)seekdir函数:set the position of the next readdir() call in the directory stream.

(12)telldir函数:return current location in directory system.

(13)rewinddir函数:resets the positon of the directory stream to the beginning of the directory.

(14)closedir函数:close  a directory。




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值