Excerpt from: http://www.liweifan.com/2012/05/13/linux-system-function-files-operation/Recently in the Linux file operation related chapters, encountered a few structure, was engaged in dizzy, today is free, carefully studied a bit, benefited.First
The dir struct under Linux is defined as1 struct__dirstream2 {3 void*__fd;4 Char*__data;5 int__entry_data;6 Char*__ptr;7 int__entry_ptr;8 size_t __allocation;9 size_t __size;Ten __libc_lock_define (, __lock) One };
Linux under struct dirent,dir,struct stat use exampleIn the following example, read the folder in the directory, file, and output some property values, specific related structure definition, can refer
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
Function Description: displays inode content.Syntax: stat [file or directory]Note: stat displays inode content in text format.
The LS command and many parameters provide some useful file information. Another unfamiliar command, stat, provides more
The operations in Python for files, folders (file action functions) need to involve OS modules and Shutil modules.
Import OS required before operation;
Returns the current directory, excluding the filename: OS.GETCWD ();
Returns all files and
In 08, when contacted Memcached, it also sniffed at its client products, after all, manual code does not have a variety of ORM Native XML configuration convenient. Still, memcached is now an integral part of the server architecture.
RELATED
[Reprint address: http://keren.blog.51cto.com/720558/144896]The LS command in Linux is primarily responsible for displaying the following information about the file:
The inode value of the file, the permission information, the user and the group to
Copy codeThe Code is as follows :/*
Simulate the ls command to implement the parameter-tariRl. Some code is repeated and can be improved.
You can add Parameters Based on the program. The program idea is clear and easy to expand.
*/
# Include
#
This article provides a detailed analysis of how to implement the c-simulated ls command in linux. For more information, seeCopy codeThe Code is as follows:
/*Simulate the ls command to implement the parameter-tariRl. Some code is repeated and can
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.