unix 下的C开发手册,还用详细的例程。

源代码在线查看: stat.html

软件大小: 3156 K
上传用户: peterzhang1982
关键词: unix
下载地址: 免注册下载 普通下载 VIP

相关代码

																				stat																The Single UNIX ® Specification, Version 2				Copyright © 1997 The Open Group												 NAME				stat - get file status				 SYNOPSIS												#include <sys/types.h>				#include <sys/stat.h>								int stat(const char *path, struct stat *buf);												 DESCRIPTION				The				stat()				function obtains information about the named file and writes it				to the area pointed to by the				buf				argument.				The				path				argument points to a pathname naming a file.  Read, write or execute				permission of the named file is not required, but all directories listed in				the pathname leading to the file must be searchable.  An implementation that				provides additional or alternate file access control mechanisms may, under				implementation-dependent conditions, cause				stat()				to fail.  In particular, the system may deny the existence of the				file specified by				path.								The				buf				argument is a pointer to a				stat				structure, as defined in the header				<sys/stat.h>,				into which information is placed concerning the file.								The				stat()				function updates any time-related fields (as described in the definition of				File Times Update				in the XBD specification), before writing into the				stat				structure.								The structure members				st_mode,				st_ino,				st_dev,				st_uid,				st_gid,				st_atime,				st_ctime				and				st_mtime				will have meaningful values for all file types defined in this document.				The value of the member				st_nlink				will be set to the number of links to the file.				 RETURN VALUE				Upon successful completion, 0 is returned.  Otherwise, -1 is returned and				errno				is set to indicate the error.				 ERRORS				The				stat()				function will fail if:												[EACCES]				Search permission is denied for a component of the path prefix.								[EIO]				An error occurred while reading from the file system.								[ELOOP]				Too many symbolic links were encountered in resolving path.								[ENAMETOOLONG]								The length of the				path				argument exceeds {PATH_MAX} or a pathname component is longer than				{NAME_MAX}.								[ENOENT]				A component of path does not name an existing file				or path is an empty string.								[ENOTDIR]				A component of the path prefix is not a directory.								[EOVERFLOW]				The file size in bytes or the number of blocks allocated to the file				or the file serial number cannot be represented correctly in the				structure pointed to by 				buf.																The				stat()				function may fail if:												[ENAMETOOLONG]								Pathname resolution of a symbolic link produced an intermediate result whose				length exceeds {PATH_MAX}.								[EOVERFLOW]				A value to be stored would overflow one of the members				of the stat structure.												 EXAMPLES				None.				 APPLICATION USAGE				None.				 FUTURE DIRECTIONS				None.				 SEE ALSO				fstat(),				lstat(),				<sys/stat.h>,				<sys/types.h>.				DERIVATION				Derived from Issue 1 of the SVID.												UNIX ® is a registered Trademark of The Open Group.				Copyright © 1997 The Open Group				 [ Main Index | XSH | XCU | XBD | XCURSES | XNS ]																							

相关资源