Chinaunix首页 | 论坛 | 博客
  • 博客访问: 591151
  • 博文数量: 126
  • 博客积分: 4379
  • 博客等级: 上校
  • 技术积分: 2110
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-06 22:35
文章分类

全部博文(126)

文章存档

2012年(5)

2011年(3)

2010年(2)

2009年(116)

分类: LINUX

2009-02-19 18:37:51

(1)   #include

int stat(const char *restrict pathname, struct stat *restrict buf);

       int fstat(int fd, struct stat *buf);

       int lstat(const char *restrict pathname, stuct  stat *restrict buf);

                                                               若成功则返回0,若出错则返回-1

struct stat{

              mode_t st_mode;

              ino_t      st_ino;

              dev_t     st_dev;

              dev_t     st_rdev;

              nlink_t    st_nlink;

              uid_t      st_uid;

              gid_t      st_gid;

              off_t       st_size;

              time_t    st_atime;

              time_t    st_mtime;

              time_t    st_ctime;

              blksize_t       st_blksize;

              blkcnt_t  st_blocks;

}

St_mode:      S_ISREGS_ISDIRS_ISCHRS_ISBLKS_ISFIFOS_ISLNKS_ISSOCK

S_IRUSRS_IWUSRS_IXUSR

S_IRGRPS_IWGRPS_IXGRP

S_IROTHS_IWOTHS_IXOTH

S_ISUIDS_ISGIDS_ISVTX

(2)#include

       int access(const char *pathname, int mode)

                                                               若成功则返回0,若出错则返回-1

Mode:    R_OKW_OKX_OKF_OK

(3) #include

mode_t umask(mode_t cmask);

                                                               返回以前的文件模式创建屏蔽字

(4) #include

       int chmod(const char *pathname, mode_t mode);

       int fchmod(int fds, mode_t mode);

                                                               若成功则返回0,若出错则返回-1

(5)#include

       int chown(const char *pathname, uid_t owner, gid_t group);

       int fchown(int fds, uid_t owner, gid_t group);

       int lchown(const char *pathname, uid_t owner, gid_t group);

                                                               若成功则返回0,若出错则返回-1

 

 

(6)#include

       int truncate(const char *pathname, off_t length);

       int ftruncate(int fds, off_t length);

                                                               若成功则返回0,若出错则返回-1

(7)#include

       int link(const char *existingpath, const char *newpath);

       int unlink(const char *pathname);

       int remove(const char *pathname);

       int rename(const char *oldname, const char *newname);

                                                               若成功则返回0,若出错则返回-1

(8)#include

       int syslink(const char *actualpath, const char *syspath);

                                                               若成功则返回0,若出错则返回-1

ssize_t readlink(const char* restrict pathname, char *restrict buf, size_t bufsize);

                                                               若成功则返回读到的字节数,若出错则返回-1

(9) #include

       int mkdir(const char *pathname, mode_t mode);

       int rmdir(const char *pathname);

                                                               若成功则返回0,若出错则返回-1

(10)#include

       DIR *opendir(const char *pathname);

                                                               若成功则返回指针,若出错则返回NULL

       struct dirent *readdir(DIR *dp);

                                                               若成功则返回指针,若在目录结尾或出错则返回NULL

       void rewinddir(DIR *dp);

       int closedir(DIR *dp);

                                                               若成功则返回0,若出错则返回-1

       long telldir(DIR *dp);

                                                               dp关联的目录中的当前位置

       void seekdir(DIR *dp, long loc);

(11)#include

       int chdir(const char *pathname);

       int fchdir(int fds);

                                                               若成功则返回0,若出错则返回-1

       char *getcwd(char *buf, size_t size);

                                                               若成功则返回buf,若出错则返回NULL

 

阅读(1039) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~