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
File file stream for fast operation of files, the main operation functions are fopen, fseek, Fread, Fclose, when the structure of the file is relatively clear when using these functions will be relatively quick to get the file location of the data,
1.2 file input and output functions
The input and output of logical devices, such as keyboards, monitors, printers, and disk drives, can be completed through file management. The most commonly used disk files are used for programming. Therefore,
Open/close/refresh Stream1. fopen () Open streamFunction:1) fopen () opens a file specified by path.2) Fdopen () gets a first file descriptor and combines a standard I/O stream with the description. This function is commonly used for descriptors
1.2 file input and output function keyboard, monitor, printer, disk drive and other logical devices, the input and output can be through the file management method to complete. And the most used in programming to be considered disk files, so this
Instance of a file handle: Locating the starting position of the unread read through the handle and chunking the large file in order to use the Read file function, you need to use the path relative to the PHP script to indicate to them the file to
1.2 file input and output function keyboard, monitor, printer, disk drive and other logical devices, its input and output can be done through file management methods.
The most important to use in programming is disk files, so this section is
PHP fopen () function
function definition and usage: the fopen () function opens a file or URL.Grammar:
fopen (Filename,mode,include_path,context)
The last two parameters are optional, we only use the first two parameters, the code is as
Fopen () is used to open local files. & Lt ;? Php $ dir = & quot; http: // localhost/tmp_data/test.txt & quot; if (! ($ Fp = fopen ($ dir, & quot; r & quot;) {& nbsp; echo & quot; cannot be opened! & Quot; fopen () open the local file, but cannot
Overview:In the recent analysis of an occasional problem, the occasional probability is particularly low, the problem is still in the analysis. Make a summary of the analytical knowledge and continue to add it later.
Problem Description:The code
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.