Computers/Linux System Programming

ch4. file & directory

emzei 2013. 4. 27. 23:44

◆ stat

 

#include<sys/stat.h>

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

(ret)  success :  0

                       failed : -1

 

◆ fstat

 

#include<sys/stat.h>

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

(ret)  success :  0

                       failed : -1

 

◆ lstat

 

#include<sys/stat.h>

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

(ret)  success :  0

                       failed : -1

 

 

 



 

 

◆ access

 

#include<unistd.h>

 int access(const char *pathname, int mode);

(ret)  success :  0

                       failed : -1

 

 

 


 

 

◆ umask

 

#include<sys/stat.h>

 mode_t umask(mode_t cmask);

(ret)   이전의 파일 모드 생성 마스크

                       

 

 

◆ chmod

 

#include<sys/stat.h>

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

(ret)  success :  0

                       failed : -1

 

 

◆ fchmod

 

#include<sys/stat.h>

 int fchmod(int filedes, mode_t mode);

(ret)  success :  0

                       failed : -1

 

 

 


 

 

◆ chown

 

#include<unistd.h>

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

(ret)  success :  0

                       failed : -1

 

 

◆ fchown

 

#include<unistd.h>

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

(ret)  success :  0

                       failed : -1

 

 

◆ lchown

 

#include<unistd.h>

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

(ret)  success :  0

                       failed : -1

 

 

◆ truncate

 

#include<unistd.h>

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

(ret)  success :  0

                       failed : -1

 

 

◆ ftruncate

 

#include<unistd.h>

 int ftruncate(int filedes, off_t length);

(ret)  success :  0

                       failed : -1

 

 

 

◆ link

 

#include<unistd.h>

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

(ret)  success :  0

                       failed : -1

 

 

◆ unlink

 

#include<unistd.h>

 int unlink(const char *pathname);

(ret)  success :  0

                       failed : -1

 

 

 


 

 

 

 

◆ remove

 

#include<stdio.h>

 int remove(const char *pathname);

(ret)  success :  0

                       failed : -1

 

 

◆ rename

 

#include<stdio.h>

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

(ret)  success :  0

                       failed : -1

 

 

◆ symlink

 

#include<unistd.h>

 int symlink(const char *actualpath, const char *sympath);

(ret)  success :  0

                       failed : -1

 

 

 

◆ readlink

 

#include<unistd.h>

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

(ret)  success :  읽은 바이트 수

                       failed : -1

 

 

◆ utime

 

#include<utime.h>

 int utime(const char *pathname, const struct utimbuf *times);

(ret)  success :  0

                       failed : -1

 

 



 

 

 

◆ mkdir

 

#include<sys/stat.h>

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

(ret)  success :  0

                       failed :  -1

 

 

◆ rmdir

 

#include<sys/stat.h>

 int rmdir(const char *pathname);

(ret)  success :  0

                       failed :  -1

 

 

 

 

◆ opendir

 

#include<dirent.h>

DIR*  opendir(const char *pathname);

(ret)  success :  포인터

                       failed :  NULL

 

 

◆ readdir

 

#include<dirent.h>

 struct dirent* readdir(DIR *dp);

(ret)  success : 포인터, 디렉토리의 끝일 경우 NULL

                       failed : NULL

 

 

◆ closedir

 

#include<dirent.h>

 int closedir(DIR *dp);

(ret)  success :  0

                       failed : -1

 

 

◆ rewinddir

 

#include<dirent.h>

 void rewinddir(DIR *dp);

 

 

◆ telldir

 

#include<dirent.h>

 long telldir(DIR *dp);

(ret)  dp에 해당하는 디렉토리 안의 현재 위치

 

 

◆ seekdir

 

#include<dirent.h>

 void seekdir(DIR *dp, long loc);

 

 


 

 

 

◆ chdir

 

#include<unistd.h>

 int chdir(const char *pathname);

(ret)  success :   0

                       failed :  -1

 

 

◆ fchdir

 

#include<unistd.h>

int fchdir(int filedes);

(ret)  success :  0

                       failed : -1

 

 

 


 

 

 

◆ getcwd

 

#include<unistd.h>

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

(ret)  success :  buf

                       failed : NULL

 

 

◆ get_current_dir_name

 

#include<unistd.h>

 char* get_current_dir_name(void);

(ret)  success :  buf

                       failed : NULL

 

 


'Computers > Linux System Programming' 카테고리의 다른 글

ch6. system data file and system information  (0) 2013.04.28
ch5. standard I/O library  (0) 2013.04.28
ch3. file I/O  (0) 2013.04.27
setjmp, longjmp  (0) 2013.04.17
file open option  (0) 2013.04.08