1. File directory operation
The top stop record is the disk root directory, with '/' or '/'
Current directory./
.. /Represents the Apache directory, the Htdocs directory
1. Create and delete directories mkdir
Copy CodeThe code is as follows:
if
Basic c: files and operations, basic c operationsFile opening and closing
First, define a FILE pointer type in the format of FILE * FILE pointer name ;;
FILE * fp; // fp is the defined FILE pointer.
● Open the file fopen () function in the format
PHP (2) Common functions record some common library functions and common syntax for reference
I. PHP Manual
Php manual Chinese address http://php.net/manual/zh
II. some common operations
2.1 string operations
2.1.1 strpos-locate the first
PHP File processing advanced application-file pointer php can implement the positioning of the file pointer and query, so as to achieve the required information fast query, the file pointer function has rewind (), fseek (), feof () and Ftell ()
PHP file Operation function There are many kinds of, today here I will share with you PHP commonly used file operation function, say, let us look at the PHP file operation what is the function of it.
1 php Gets the file name:basename-returns the
1. File directory operation
The topmost stop is the disk root directory, with '/' or '//'
Current directory./
.. /indicates that the Apache directory is the Htdocs directory
1. Creating and Deleting Directories mkdir
Copy CodeThe code is as follows:
First, the conclusion:File r+ Open:1. Write () cannot implement insert write, it always overwrites write or append write;2. If the file is open as write (), overwrite the write from the beginning;3. If the file is open, use F.seek () to specify the
Accounting for 134 (experimental Class) Jangafopen open file or URLResource fopen (String $filename, String $mode) open failure returns falseThe mode parameter specifies the list of access types required to the stream:
Mode
Http://www.programfan.com/article/showarticle.asp? Id = 2697
The so-called "file" refers to an ordered set of related data. This dataset has a name called a file name. In fact, we have used files many times in the previous chapter, such as source
Fgets (read a string from the file)Related functions: open, fread, fscanf, GETCHeader file include Define the function char * fgets (char * s, int size, file * stream );Function Description: fgets () is used to read characters from the file referred
First, the path1, DirName--Returns the directory part of the path$path = "/etc/passwd";$file = DirName ($path); "/etc"2, BaseName--Returns the file name part of the path$path = "/home/httpd/html/index.php";$file = basename ($path); index.php$file =
array_change_key_case-returns an array with a string key that is all lowercase or uppercase
array_chunk-to split an array into multiple
Array_combine-creates an array with the value of one array as its key name and the value of the other array as
When we read the contents of the file, and can not read repeatedly, such as a blogCblog.txt file has blogcblog content, with two read () method reading BlogCblog.txt content, will find that the first to return the contents of the file, the second
This article mainly introduces the Python operation files, as well as the simple copy backup. Hope to help everyone.
1.open functionEverything in Python is object, so normal. The process of opening a file is1. Select File-Open file-edit, copy,
fopen (Open file)Correlation function Open,fclose
Table header file #include
Defines the function FILE * fopen (const char * path,const char * mode);
The function description parameter path string contains the file path and filename to open, and
The following is a detailed analysis of common functions in PHP. For more information, see array_change_key_case. the returned string key names are all lowercase or upper-case arrays.
Array_chunk-divide an array into multiple
Array_combine-creates
Small series of PHP for beginners today to introduce PHP file operations commonly used methods summary, including: file read and write, create, view file properties, file deletion and so on the operation of the file.
Before accessing a file, we
PHP Read-write file implementation code, collation is also good, the need for friends can refer to.
To read and write files in PHP, you can use the built-in functions:1.fopen (create file and open file)Grammar:
The code is as follows:
fopen
Directory functions
chdir-Changing directories
chroot-Changing the root directory
closedir-Closing a directory handle
Dir-return an instance of the Directory class
Getcwd-get Current working directory
opendir-opening a directory
fopen (Open file)
Correlation function Open,fclose
Table header file #include
Defines the function FILE * fopen (const char * path,const char * mode);
Function description The path string contains the file path and filename to open, and the
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.