|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T r
Length: 1154 (0x482)
Types: TextFile
Names: »read.c.orig«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Wanderer/read.c.orig«
#include "wand_head.h"
extern int edit_mode;
extern char screen[NOOFROWS][ROWLEN+1];
int rscreen(num,maxmoves)
int *maxmoves, num;
{
int y;
FILE *fp;
char name[50];
char (*row_ptr)[ROWLEN+1] = screen;
if(!edit_mode)
sprintf(name,"%s/screen.%d",SCREENPATH,num);
else
sprintf(name,"./screen");
fp = fopen(name,"r");
if(fp == NULL)
printf("\nFile for screen %d unavailable.\n\n",num) ;
else
{
for(y = 0;y<NOOFROWS;y++)
{
fgets((*row_ptr++),ROWLEN + 1,fp);
fgetc(fp); /* remove newline char*/
};
if(fscanf(fp,"%*s\n%d",maxmoves) != 1)
*maxmoves=0;
fclose(fp);
};
return (fp == NULL);
}
int wscreen(num,maxmoves)
int maxmoves, num;
{
int y,x;
FILE *fp;
char (*row_ptr)[ROWLEN+1] = screen;
fp = fopen("./screen","w");
if(fp == NULL)
printf("\nFile for screen cannot be written.\n\n") ;
else
{
for(y = 0;y<NOOFROWS;y++)
{
for(x = 0;x<ROWLEN;x++)
fputc(row_ptr[y][x],fp);
fputc('\n',fp);
};
for(x = 0; x<ROWLEN;x++)
fputc('#',fp);
fputc('\n',fp);
if(maxmoves != 0)
fprintf(fp,"%d\n",maxmoves);
fclose(fp);
};
return (fp == NULL);
}