C 如何将file.dat中的数据存储到结构数组
我想问一下如何将文件.dat(从结构数组写入文件后)中的数据存储到Book的新结构数组中。请帮助 你的意思是像C 如何将file.dat中的数据存储到结构数组,c,arrays,file,struct,C,Arrays,File,Struct,我想问一下如何将文件.dat(从结构数组写入文件后)中的数据存储到Book的新结构数组中。请帮助 你的意思是像intitemsread=fread(lstBook,sizeof(structbook),Capacity,infle)?很有效,非常感谢!! #define Capacity 1000 struct Book{ char BookID[10]; char Title[100]; char Author[50]; floa
intitemsread=fread(lstBook,sizeof(structbook),Capacity,infle)代码>?很有效,非常感谢!!
#define Capacity 1000
struct Book{
char BookID[10];
char Title[100];
char Author[50];
float Price;
int YearOfRelease;
} lstBook[Capacity];
FILE *infile;
infile = fopen ("C:\\Users\\Admin\\Desktop\\BookMan6\\BookMan.dat","rb");
if (infile == NULL)
{
fprintf(stderr, "\nError opening BookMan.dat\n\n");
exit(1);
}