当前位置:网站首页>C language file operation
C language file operation
2022-07-06 14:05:00 【bytenums】
- What is a document
- file name
- file type
- File buffer
- The file pointer
- Opening and closing of files
- Sequential reading and writing of files
- Random reading and writing of documents
- Determination of end of document
Text begins
What is a document
The files on disk are files .
But in programming , There are two kinds of documents we usually talk about : Program files 、 Data files
Program files
- Include source files ( The suffix is .c), Target file (windows Environment suffix is .obj), Executable program (windows Environment suffix is .exe).
Data files
- The content of the file is not necessarily a program , It's the data that the program reads and writes when it runs , For example, the file from which the program needs to read data , Or output content file .
This chapter discusses data files .
In the previous chapters, the input and output of the processed data are targeted at the terminal , That is, input data from the keyboard of the terminal , The operation results are displayed on the display .
In fact, sometimes we output information to disk , When necessary, read the data from the disk to the memory for use , What we are dealing with here is the files on the disk .
file name
A file should have a unique file ID , So that users can identify and reference .
The filename contains 3 part : File path + File name trunk + file extension
for example : c:\code\test.txt
For convenience , Document identification is often referred to as file name .
file type
According to the organization of data , Data files are called text file perhaps Binary .
Data is stored in memory in binary form , If the output without conversion is to external memory , Namely Binary .
If it's required to use ASCII In the form of code , You need to convert before storing . With ASCII The file stored in the form of characters is text file .
How is a data stored in memory ?
All characters are written in ASCII stored , Numerical data can be used either ASCII stored , It can also be stored in binary form .
If there are integers 10000, If the ASCII Code output to disk , The disk is occupied by 5 Bytes ( One byte per character ), And binary form input Out , On the disk 4 Bytes (VS2013 test ).
边栏推荐
- WEB漏洞-文件操作之文件包含漏洞
- 7-6 矩阵的局部极小值(PTA程序设计)
- 7-7 7003 组合锁(PTA程序设计)
- 7-6 local minimum of matrix (PTA program design)
- 记一次edu,SQL注入实战
- Spot gold prices rose amid volatility, and the rise in U.S. prices is likely to become the key to the future
- 7-11 机工士姆斯塔迪奥(PTA程序设计)
- Tencent map circle
- 7-15 h0161. 求最大公约数和最小公倍数(PTA程序设计)
- JS several ways to judge whether an object is an array
猜你喜欢
Hackmyvm target series (3) -visions
. How to upload XMIND files to Jinshan document sharing online editing?
Principles, advantages and disadvantages of two persistence mechanisms RDB and AOF of redis
撲克牌遊戲程序——人機對抗
浅谈漏洞发现思路
HackMyvm靶机系列(5)-warez
强化学习基础记录
Applet Web Capture -fiddler
Nuxtjs quick start (nuxt2)
Hackmyvm target series (7) -tron
随机推荐
7-6 矩阵的局部极小值(PTA程序设计)
Safe driving skills on ice and snow roads
xray與burp聯動 挖掘
Principles, advantages and disadvantages of two persistence mechanisms RDB and AOF of redis
msf生成payload大全
SQL注入
Yugu p1012 spelling +p1019 word Solitaire (string)
Experiment 4 array
. How to upload XMIND files to Jinshan document sharing online editing?
7-15 h0161. Find the greatest common divisor and the least common multiple (PTA program design)
Have you encountered ABA problems? Let's talk about the following in detail, how to avoid ABA problems
7-3 construction hash table (PTA program design)
7-4 散列表查找(PTA程序设计)
内网渗透之内网信息收集(五)
实验五 类和对象
A piece of music composed by buzzer (Chengdu)
7-9 make house number 3.0 (PTA program design)
记一次api接口SQL注入实战
7-5 走楼梯升级版(PTA程序设计)
About the parental delegation mechanism and the process of class loading