如何将程序数据加载并保存到文件中?我有14个函数要保存到文件中,以后可以再次加载它。到目前为止,这就是我所拥有的。
/*assume I have a bunch of codes here that has the following parameters
2 header files
2 c files
14 functions including save_file and load_file
*/
void save_file(gradebook *info) {
FILE *out;
char filename[10];
printf("Enter name of file: ");
scanf("%s", filename);
out = fopen(filename, "w");
/*function that reads all the characters and user input*/
fclose(out);
}
我已经谷歌搜索并在整个论坛中查看了好几天,而且我被卡住了。任何人都可以帮助我吗?