-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsauv.c
More file actions
37 lines (30 loc) · 729 Bytes
/
sauv.c
File metadata and controls
37 lines (30 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "header.h"
void charger(personne *p, background *b , char * nomfichier, int *min, int *sec)
{
FILE *f=fopen(nomfichier,"r");
if(f==NULL)
{
printf("Erreur !");
}
else
{
printf("loading");
while (fscanf(f,"%hd %hd %d %d %hd %hd %d %d\n",&(p->pos_hero.x),&(p->pos_hero.y),&(p->health),&(p->score),&(b->camera.x),&(b->camera.y),min,sec)!= EOF)
{}
}
fclose(f);
}
void sauvegarder(personne p, background b , char * nomfichier,int min, int sec)
{
FILE *f=fopen(nomfichier,"a+");
if(f==NULL)
{
printf("Erreur !");
}
else
{
printf("saving");
fprintf(f,"%hd %hd %d %d %hd %hd %d %d\n",p.pos_hero.x,p.pos_hero.y,p.health,p.score,b.camera.x,b.camera.y,min,sec);
}
fclose(f);
}