text 什么是C中的文件指针

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 什么是C中的文件指针相关的知识,希望对你有一定的参考价值。

File Pointers

What is persistent data:
Data that does not disappear when your program stops running. 

Like a normal program, we can see the running result printed on screen, but the actual result is not stored anywhere. After we finish running the program and clear the screen, there's nothing recorded of the program, it's like it's never existed.

But sometimes we want to record data when running the program. Like if you wrote a program for a game, you want to record every player's moves, so you can go back to it if something went wrong later. You'll have a record of data of all the moves the player had taken during the game. So when the program finished running, we still have all the data of what happened when the program was running. That is "persistant data".

In order to store persistent data, we need to open a file, and then write data from the program into that file. "FILE" is a special data structer in C that is used to store persistent data. When working with them, we will be using pointers to them, FILE*.

以上是关于text 什么是C中的文件指针的主要内容,如果未能解决你的问题,请参考以下文章

从C中的文件指针获取文件名[重复]

C语言中的“悬空指针”和“野指针”是什么意思?

C语言 结构体指针字符 二进制文件写入和读取

C|指针的10种经典应用场合

C语言中的定位,谈谈对指针的基本理解

C语言中的定位,谈谈对指针的基本理解