PHP Tutorial File read operation
The way in which data is stored in a text file is mainly three steps and some file operation functions are as follows:1, open the file (file operation function: fopen)2, file data read (File operation function:
Do read the file today to practice when encountered a problem, and then in Baidu to find relevant solutions. Found this article, I feel good, special reproduced over, for everyone's reference, I believe that we will have a different harvest.
The
string read and Write functions fgets and fputs
The function of reading string function Fgets function is to read a string from a specified file into a character array in the form of a function call: fgets (character array name, n, file pointer),
Author: Wang Shanshan,Hua Qing vision embedded college lecturer.
In standard Io, there are only three methods to read and write files:
(1) I/O of each character.(2) I/O of each row.(3) Direct I/O.
It seems that these functions seem very simple, but
1
C file operations
FileBasic concepts of FilesThe 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
String read/write functions fgets and fputs
1. The fgets function of the string reading function reads a string from a specified file to a character array. The function is called in the form of fgets (character array name, n, file pointer);
This article mainly introduces the summary of functions related to PHP file read/write operations. This article summarizes fwrite (), fread (), fgets (), fgetc (), file (), readfile () for more information about functions and examples, see
I. fwrite
string read and Write functions fgets and fputs
The function of reading a string function Fgets function is to read a string into a character array from the specified file, in the form of a function call: fgets (character array name, n, file pointer)
Use php to get 163 mail information, and read 163 mail information with php ,? $ Host = ">
$ Host = 'pop .163.com ';$ Port = 110;$ User = '******';$ Password = '******';
If (! ($ Sock = fsockopen (gethostbyname ($ host), $ port, $ errno, $ errstr
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
When a C language program is started, the operating system environment is responsible for opening three files and providing pointers to these three files to the program. The three files are standard input (stdin), standard output (stdout), and
In the C language, file operations are done by library functions. The main file manipulation functions are described in this chapter.File Open function fopenThe fopen function is used to open a file whose invocation is in the general form of a file
1. File manipulation based on file pointers (buffering)Linux directory and device operations are file operations, files are divided into ordinary files, directory files, linked files and device files.1.1. File creation, opening and closingThe
inputThe gets () function:1.gets () reads the string from the standard input device, returns to the end of the read, uses ' \ n ' to end, and the carriage return ' \ nthe ' is discarded without remaining in the buffer. 2. Can be used to enter a
C language File read and write operation summary
C Language File operation
I. Reading and writing of standard documents
1. Open the file
The open operation of the fopen () file means that the file specified by the user is allocated a filename in
File system developed in php
1. open/close the file
Use the fopen () function and fclose () function to open/close the file respectively. When opening a file, you should pay special attention to the possibility of deleting all the file content
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.