The relationship between file descriptors and open files in Linux
Guide
The kernel (kernel) accesses files using file descriptors (descriptor). The file descriptor is a non-negative integer. When you open an existing
Today we talk about "various formats of file opening and file type indisputable circumstantial" topic, I have been engaged in computer 10 years, from the early 286 computers to the current 6 nuclear computers, from the previous DOS system to the current Windows 7 can be said to have experienced, During all these years of computer work, many friends often ask "what is this?" That's what the
Last reprinted an article "PowerShell view open File default Application", its bright spot is to invoke the Windows API, the idea is very unique, but may not be practical. Later @j in the original comment, said Assoc + ftype more convenient. So Assoc and ftype is a god horse thing, I briefly describe.
Assoc and Ftype are two commands on the Windows system cmd.exe:
The former Assoc can return a
People who know a little about C programming know that text files and binaries are stored in 0,1 on a computer, so how are the two different? For programmers, text files and binaries are statements that indicate how you should open the file (text/binary), what functions to read and write to the file (read-write function), and how to read the end of the
In C, file operations are done by the library function, which describes the opening and closing of files.
File open (fopen function)
The fopen () function is used to open a file whose prototype is:
FILE *fopen (Char *filename,
function: Open ()1: Function: Open a file2: Syntax:Open (file[, mode[, buffering[, encoding[, errors[, newline[, Closefd=true]])3: Parameter Description:File: The filename to open, plus the path (unless it is in the current directory). Unique Mandatory ParametersMode: File
1. OverviewIn the Linux system, everything can be considered as a file, and the file can be divided into: Ordinary files, directory files, linked files and device files. File descriptor is the index created by the kernel in order to efficiently manage files that have been opened, which is a nonnegative integer (usually a small integer) used to refer to the
1. Open () syntax Open (file[, mode[, buffering[, encoding[, errors[, newline[, Closefd=true]]] []] The Open function has many parameters, often file,mode and encoding file location, which requires quotes mode
r,r+,w,w+,a,a+ effect
R
Read-only
Do not create
r+
Write
W
New Write-only
Both will empty the file
w+
New Read/write
A
Attach write mode open, unreadable
A +
Additional read and write mode open
The
Reprint please indicate source: http://blog.csdn.net/cywosp/article/details/389652391. Overviewin the Linux system, everything can be considered as a file, and the file can be divided into: Ordinary files, directory files, linked files and device files. File descriptor is the index created by the kernel in order to efficiently manage files that have been opened,
File operations under Linux (C + +) Open, fopen, and FreopenOpen is the underlying system call function under Linux, the standard I/O library functions under fopen and Freopen C/s, with input/output buffering.Linxu under the fopen is the open encapsulation function, fopen ultimately to call the underlying system call open.So under Linux, if you need to have expli
Source: http://blog.csdn.net/ztf312/The first step to exclude file open mode error:R Read-only , r+ read/write, not createdW New Write-only , w+ New Read-write , both will clear the contents of the file 0 (opens in W mode and cannot be read out.) w+ Readable and writable)The difference between w+ and r+:r+: Readable and writable, if the
File operations under Linux (C + +) Open, fopen, and FreopenOpen is the underlying system call function under Linux, the standard I/O library functions under fopen and Freopen C/s, with input/output buffering.Linxu under the fopen is the open encapsulation function, fopen is finally to invoke the underlying system call open.So under Linux it is assumed that there
Analysis of open mode of C language fileIn the C language file manipulation syntax, open file files have the following 12 modes, such as:
open Mode
can only read
can only write
read Write both
Open is the underlying system call function under Linux, the standard I/O library functions under fopen and Freopen C/s, with input/output buffering.Linxu under the fopen is the open encapsulation function, fopen ultimately to call the underlying system call open.So under Linux, if you need to have explicit control over your device, it's best to use the underlying system call (
I. What is a documentBefore we tell the file operation, we need to know what the file is. You may feel ridiculous to see this, because a file is the simplest concept for a computer person, such as a text is a file, a work document is a file, and so on. But in Linux, the conc
For the use of CD-ROM or virtual optical drive installation of the operating system or other large software can be seen in the installation of the file is an ISO file, many friends do not know what to open the ISO file, what is the ISO file? The simplest is the ISO-extension
What is SWF file, swf file is Flash animation file, then the SWF file with what open? In fact, you need to open the SwF file method is very much, the following editor introduces you sev
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.