| Example | Relevant Functions |
4.1 | Print file types (directory, symlink, device etc.) |
lstat
|
4.2 | Check file access permissions |
access,
open
|
4.3 | Unmasking file permission bits during file creation |
umask,
creat
|
4.4 | Change file permissions (modes) |
stat,
chmod
|
4.5 | Remove (unlink) a file |
unlink,
open
|
4.6 | Truncate file to zero length leaving modified dates intact |
stat,
open (w/ O_TRUNC),
utime
|
4.7 | mini "find": Traverse a directory tree + counting file types |
lstat,
opendir,
readdir,
closedir,
strcmp,
strcpy
|
4.8 | Change directory |
chdir
|
4.9 | Change directory + Print current directory |
chdir,
getcwd
|
4.10 | Print device driver numbers (major + minor) |
lstat (st_dev, st_rdev)
|