#include<stdio.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
//商店结构体
struct shop{
int type;
char name[50];
int num;
float price;
char pic_path[1024];
};
void save_shop(int type,char *name,int num,float price,char* path)
{
//打开商店文件
FILE *fp = fopen("shop.txt","a+");
if(fp==NULL){puts("open shop.txt fail");return;}
//写文件
fprintf(fp,"%d %s %d %.2f %s\n",type,name,num,price,path);
fclose(fp);
}
void load_shop()
{
FILE *fp = fopen("shop.txt","r");
while(1)
{
// char name[50],path[1024];
// int num,type;
// float price;
struct shop s;
int ret = fscanf(fp,"%d %s %d %f %s\n",&s.type,s.name,&s.num,&s.price,s.pic_path);
if(ret == -1)break;//读取完毕
printf("%d