要读取一个txt文件,首先要使用文件打开函数fopen()。 fopen函数用来打开一个文件,其调用的一般形式为: 文件指针名=fopen(文件名,使用文件方式) 其中,“文件指针名”必须是被说明为FILE 类型的指针变量,“文件名”是被打开文件的文件名。 “使用文件方式”是指文件的类型和操作要求。“文件名”是字符串常量或字符...
include <stdio.h>#include <stdlib.h> #define SIZE_view 50 struct view_info {int id;char name[20];int code;char shortname[20];char LName[100];}views[SIZE_view];int read() {FILE *fp;int n = 0;if((fp = fopen("1.txt","rt")) == NULL) {printf("不能打开数据文...