The STAT system call series includes Fstat, Stat, and Lstat, all of which are used to return "related file state information", except that the source file is set differently. The first introduction is a very important type of struct, named struct
Fstat, stat, and lstat usage, fstatstatlstat
The stat System Call series include fstat, stat, and lstat, which are used to return "Related File status information". The difference between the three is that the source file setting method is different.
Stat function ExplanationTable header files: #include #include Define functions: Int stat (const char *file_name, struct stat *buf);Function Description: Obtains file information by filename, and is stored in the structure stat referred to by
Attention
1. Some platforms do not support Stat64,
2. Get the type of file size off_t,
The off_t type in Linux is a 32-bit long int (4 bytes) by default.
The file may overflow when it is too large.
It is recommended that GCC compile-time
Stat Function Description
Header file: # include # Include Define the function: int Stat (const char * file_name, struct stat * BUF );Function Description: get the file information through the filename file name and store it in the struct stat
The Linux stat function explains:Table header files: #include #include Define functions: Int stat (const char *file_name, struct stat *buf);Function Description: Obtains file information by filename, and is stored in the structure stat referred to
Find the stat structure in the header file zookeeper. Jute. H. First, you need to understand the features of this variable:
1. Most zookeeper c api parameters exist.
2. It is passed out as the node information variable of znode for external query
NOTE: Reprint please indicate the source
The specific information for the function is as follows:
function to get file information
Header file
function form
int stat (const char *path, struct stat *buf);int fstat
[Fstat/STAT/lstat System Call]Function Description:Obtain file-related information.Usage:# Include # Include # Include
Int Stat (const char * path, struct stat * BUF );Int fstat (INT filedes, struct stat * BUF );Int lstat (const char * path, struct
Name
Stat, fstat, lstat-Get File statusSynopsis
# Include # Include # Include
Int Stat (const char *Path, Struct stat *Buf);Int fstat (int FD, Struct stat *Buf);Int lstat (const char *Path, Struct stat *Buf);
Feature test macro requirements for
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.