如何实现文件的新建、保存、编辑、关闭、退出等操作?

#include "graphics.h"
#include "extgraph.h"
#include "genlib.h"
#include "simpio.h"
#include "random.h"
#include "strlib.h"
#include "conio.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <windows.h>
#include <olectl.h>
#include <stdio.h>
#include <mmsystem.h>
#include <wingdi.h>
#include <ole2.h>
#include <ocidl.h>
#include <winuser.h>
#include<math.h>

struct Data
{
	char variable_name[10];
	double value;
	struct Data *Next_Data;
};
struct Point
{
	double x;
	double y;
	struct Point *Next_Point;
};
typedef struct List
{
	char list_name[10];
	char color[30];
	int ifBar;
	int ifLine;
	int ifPie; 
	struct Data *address;
	struct List *Next_List;
	struct Point *c;
}*LIST;

//将文件数据读入链表 
/*List CreatList()
{
	List head,end,p;
	FILE *fp;
	head=(List)malloc(sizeof(List));
	p=head;
	p->Next_List=NULL;
	
	fp=fopen("test.txt","r");
	
	while(!feof(fp))
	{
		end=(List)malloc(sizeof(List));
		p->Next_List=end;
		p=end;
		p->Next_List=NULL;
		
		fscanf("%s %lf",p->address->variable_name,p->address->value);
	}
	fclose(fp);
	return head;
}*/
//文件保存 
void CreatFile(LIST p)
{
	FILE *fp;LIST q=p;
	fp=fopen("NewFile.txt","wb");
	if(fp!=NULL)
	{
		while(q)
		{
			
			fprintf(fp,"%s %s %d %d %d",q->list_name,q->color,q->ifBar,q->ifLine,q->ifPie);
			while(q->c)
			{
				fprintf(fp,"%lf %lf",q->c->x,q->c->y);
				q->c=q->c->Next_Point; 
			}
		}
	}
	fclose(fp);
}

//文件
List  OpenFile(FILE *fp)
{
	List head,end,p;
	head=(List)malloc(sizeof(List));
	p=head;
	p->Next_List=NULL;
	return head;
} 

void Main()
{
	List p;
	if(/*新建*/)
	{
		p=CreatList();
		
	}
	
}

利用给定的libgraphics库制作一个简易的数据可视化小程序,如何实现将绘制好的图表通过文件保存,对统计图表修改后将数据更新至文件。

要使用图形库graphics的各种画图函数,实现可视化

您的问题已经有小伙伴解答了,请点击【采纳】按钮,采纳帮您提供解决思路的答案,给回答的人一些鼓励哦~~

ps:开通问答VIP,享受5次/月 有问必答服务,了解详情↓↓↓

【电脑端】戳>>>  https://vip.csdn.net/askvip?utm_source=1146287632
【APP 】  戳>>>  https://mall.csdn.net/item/52471?utm_source=1146287632