void save()//working
{
short i;
short j;
Clear_Screen();/*a function using the windows.h header file to replace system("cls");*/
printf("Saving...");
FILE *fp;
fp=fopen("Map.TTXT", "w");
for (i = 0;i < MAXX;i++)
{
for(j = 0;j < MAXY;j++)
{fprintf(fp, "%d\n", Map.Map[i][j]);}/*map is a struct and Map.Map
is a 2d array in the struct */
}
fclose(fp);
printf("\nSaved!\nHit enter to continue");
getch();
}
void load()//sort of working
{
short i;
short j;
char ch[85];
char File[9] = "Map.TTXT";
Clear_Screen();
printf("loading...\n");
FILE *fp;
fp=fopen(File, "r");
for (i = 0;i < MAXX;i++)
{
for(j = 0;j < MAXY;j++)
{
while(fgets(ch, 85, fp)){Map.Map[i][j] = ch[i];}}
}
fclose(fp);
printf("\nfinished\n");
getch();
}