: 使用读的方式打开一个文件 ;
FILE *p = fopen("D:\\a.txt", "r");
然后 , 调用 fgets...方法 , 从文件中读取数据 ;
char *fgets(char *str, int n, FILE *stream)
char *str 参数 : 将文件中的文本读取到哪里去 ;
int n 参数...: 读取多少数据 , 单位字节 ;
FILE *stream 参数 : 读取哪个文件中的数据 ;
多行文本读取 : 通过 feop 函数判定是否读取到了文件结尾 , 如果已经读取到了文件结尾 , 则返回...feof(p))
{
memset(s, 0, sizeof(s));
// 读取文件到 s 数组中
fgets(s, sizeof(s), p)...feof(p))
{
memset(s, 0, sizeof(s));
// 读取文件到 s 数组中
fgets(s, sizeof(s), p)