void stat(FILE *fp1) // To give information about file metadata
{
	int a,in,size,sind;
	char g,fnam[15],m;
	printf("\nEnter the filename with extension for which you want to get information\n");
	g=getchar();
	gets(fnam);
	a=search_f(fnam);
	if(a==1)
	{
		printf("\nFile does not exist\n");
	}
	else
	{
		fseek(fp1,a,0);
		in=getw(fp1);
		printf("Inode No: %d\n",in);
		printf("File Name: %s\n",fnam);
		fseek(fp1,17,1);
		size=getw(fp1);
		printf("File Size: %d\n",size);
		fseek(fp1,1,1);
		sind=getw(fp1);
		printf("Single Indirect block Address: %d\n",sind);
		fseek(fp1,1,1);
		fread(&m,1,1,fp1);
			if(m=='s')
			printf("Read and write permission\n");
			if(m=='r')
			printf("Read only permission\n");
			if(m=='w')
			printf("Write only permission\n");
	}
	return;
}		 
Esempio n. 2
0
	int charset::draw(string numstr, alignment align, vector2d pos, float alpha)
	{
		char length = numstr.length();
		int shift = 0;
		int total = 0;

		switch (align)
		{
		case cha_center:
			for (char i = 0; i < length; i++)
			{
				total += getw(numstr[i]);
			}
			shift -= total / 2;
		case cha_left:
			for (char i = 0; i < length; i++)
			{
				shift += getw(numstr[i]);
				draw(numstr[i], pos + vector2d(shift, 0), alpha);
			}
			break;
		case cha_right:
			for (char i = length - 1; i >= 0; i--)
			{
				shift += getw(numstr[i]);
				draw(numstr[i], pos - vector2d(shift, 0), alpha);
			}
			break;
		}
		return shift;
	}
//senquack - modified to be more flexible with filename (now defined in rr.c)
// Load preference.
void loadPreference() {
   FILE *fp;
   int i, j;
   int version;
//   char *tmpname;
//   char name[128];
//   tmpname = getenv("HOME");
//   strcpy(name, tmpname);
//   strcat(name, PREF_FILE);
//   if ( NULL == (fp = fopen(name,"rb")) ) {
   if ( NULL == (fp = fopen(full_prefs_filename,"rb")) ) {
      printf("Error opening prefs for reading or file not found: %s\n", full_prefs_filename);
      initHiScore();
      return;
   }
   version = getw(fp);
   if ( version != VERSION_NUM ) {
      initHiScore();
      return;
   }
   for ( j=0 ; j<MODE_NUM ; j++ ) {
      for ( i=0 ; i<STAGE_NUM ; i++ ) {
         hiScore.score[j][i] = getw(fp);
         hiScore.cleard[j][i] = getw(fp);
      }
   }
   hiScore.stage = getw(fp);
   hiScore.mode = getw(fp);
   fclose(fp);
}
void write(FILE *fp1) // To write data at the dataspace for a file
{
	int a,u,si,free_point,da2=1,siz;
	char cm[15],g,h,inpdat[100],m,c;
	printf("\nEnter the file name with extension you want to write in\n");
	g=getchar();
	gets(cm);
	a=search_f(cm);
	if(a==1)
	printf("\nFile does not exist\n");
	else
	{
		fseek(fp1,a+31,0);
		fread(&m,1,1,fp1);
		if(m=='r')
		{
			printf("\nUser has read only permisssion so can't write\n");
		}
		else
		{	
			fseek(fp1,a+26,0);
			si=getw(fp1);
			fseek(fp1,frees,0);
	
	while(da2!=0)
	{       
         	da2=getw(fp1);
		printf("\n%d\n",da2);
		if(da2==0)
		{
			fseek(fp1,-4,1);
                        putw(da,fp1);
			//fseek(fp1,frees,0);
			//u=getw(fp1);
			//printf("%d",u);
			//fseek(fp1,4,1);
                        fwrite(&co,1,1,fp1);
      		}
		else
		{		
			fseek(fp1,frees+4,1);
			da=da+102400;	
		}
	}
	        fseek(fp1,si,0);
		putw(da,fp1);
		fwrite(&co,1,1,fp1);
		//printf("%d",da);
		fseek(fp1,da,0);
		printf("\nEnter the data you want to put in a file\n");
		h=getchar();
		gets(inpdat);
		siz=strlen(inpdat);
		fwrite(inpdat,100,1,fp1);
		fseek(fp1,a+21,0);
		putw(siz+1,fp1);
		
		}
	}		
}
Esempio n. 5
0
// Load preference.
void loadPreference() {
  FILE *fp;
  int i, j;
  int version;
  char *tmpname;
  char name[128];

  tmpname = getenv("HOME");
  strcpy(name, tmpname);
  strcat(name, PREF_FILE);

  if ( NULL == (fp = fopen(name,"rb")) ) {
    initHiScore();
    return;
  }
  version = getw(fp);
  if ( version != VERSION_NUM ) {
    initHiScore();
    return;
  }
  for ( i=0 ; i<STAGE_NUM ; i++ ) {
    hiScore.stageScore[i] = getw(fp);
    for ( j=0 ; j<SCENE_NUM ; j++ ) {
      hiScore.sceneScore[i][j] = getw(fp);
    }
  }
  for ( i=0 ; i<ENDLESS_STAGE_NUM ; i++ ) {
    hiScore.stageScore[i+STAGE_NUM] = getw(fp);
  }
  hiScore.stage = getw(fp);
  fclose(fp);
}
Esempio n. 6
0
void grafo::CHRISTOFIDES(void) {

 // Aplica o KRUSKAL para determinar a minima espassão em árvore
 KRUSKAL();

 // encontrar vertices com grau impar
 vector<point> odd_degree;
 for( num i=0; i<size(); i++) {
  if( degre(i)%2==1) {
   odd_degree.push_back(R[i]);
  }
 }

 for( num k=0; k<size()-1; k++)
  for( num t=k+1; t<size(); t++) 
   M.V[k][t]=M.V[t][k]=false;


// char out[]="output.dat";
// ofstream saida( out);

// for( num k=0; k<odd_degree.size(); k++) 
//  saida << odd_degree[k].real() << " " << odd_degree[k].imag() << endl;

// this->grafo(odd_degree);

 // encontrar o "perfect matching" com peso mínimo dos vértices impares
 // obs: usar o mesmo passo do KRUSKAL
// madj Aux(odd_degree);

 vector<bool> visited(size());
 for( num k=0; k<odd_degree.size()*(odd_degree.size()-1)/2; k++) {
  double aux=INF;
  vertex v=0, w=0;
  for( num i=0; i<odd_degree.size()-1; i++) {
   vertex p=enu(odd_degree[i]);
   for( num j=i+1; j<odd_degree.size(); j++) {
    vertex q=enu(odd_degree[j]);
    if( connected(p,q)) break;
    if(getw(p,q) < aux & !visited[q] & !visited[p]) {
     v=p; w=q; aux=getw(q,p);
    }
   }
  }
//  cout << v << "<->" << w << endl;
  if(aux==INF) break;
  if( !visited[v] & !visited[w]) {
   connect(v, w);
   visited[v]=visited[w]=true;
  }
  
 }
 // Selecionar um circuito de Euler
 // Usar pesquisa usando DFS para encontrar um circuito de Euler, uma dúvida trivial é se pode
 // existir mais de um circuito no grafo.
// for( num k=0; k<size(); k++) {
  
// }

}
Esempio n. 7
0
File: spew.c Progetto: pstef/cq410z
void readcclass(register classrec *cp)
{
  register int n;
  register defn *dp;
  defn **dput;

  char store[MAXDEF]; /* for tags */

  cp->weight = getw(InFile);
  instring(store, MAXDEF);
  cp->tags = (store[0] == '\0') ? NullTags : save(store);
  n = getw(InFile);
  if (n <= 0)
    badfile();
  dput = &(cp->list); /* link on here */
  while (n--) {
    dp = (defn *)my_alloc((unsigned) sizeof(defn));
    *dput = dp;
    dp->cumul = getw(InFile);
    instring(store, MAXDEF);
    dp->string = save(store);
    dput = &(dp->next);
  }
  *dput = NULL; /* last one */
}
Esempio n. 8
0
inline void geta(T *a){
	T n=0,s=1;
	char p=getw();
	if(p=='-') s=-1;
	while((p<'0'||p>'9')&&p!=EOF&&p!='-') p=getw();
	if(p=='-') s=-1,p=getw();
	while(p>='0'&&p<='9') { n = (n<< 3) + (n<< 1) + (p - '0'); p=getw(); }
	*a = n*s;
}
Esempio n. 9
0
static void
getstate(void)				/* get driver state variables */
{
	fread((char *)&comm_driver.pixaspect,
			sizeof(comm_driver.pixaspect), 1, devin);
	comm_driver.xsiz = getw(devin);
	comm_driver.ysiz = getw(devin);
	comm_driver.inpready = getw(devin);
}
Esempio n. 10
0
void get_replay_name (const char *filename, char *namebuf) {
  FILE *in = fopen(filename, "rb");
  if (in == NULL)
    return;

  char buffer [100];
  fread (buffer, 12, 1, in);
  buffer[12] = 0;
  if (strcmp (buffer, "AGSRecording") != 0) {
    fclose (in);
    return;
  }

  fgetstring_limit (buffer, in, 12);
  if (buffer[0] != '2')  {
    // very first alpha version, can't play it
    fclose (in);
    return;
  }
  int replayver = getw(in);

  if ((replayver < 1) || (replayver > 3)) {
    fclose (in);
    return;
  }

  namebuf[0] = 0;
  if (strcmp (buffer, enginever))
    strcpy (namebuf, "!! ");

  if (replayver == 1) {
    // first version didn't save info
    strcat (namebuf, "(unknown replay)");
    fclose (in);
    return;
  }

  fgetstring_limit (buffer, in, 99);
  // skip the UID
  getw (in);
  strcat (namebuf, buffer);
  strcat (namebuf, " (");
  // skip the total time
  int tottime = getw (in);
  sprintf (&namebuf[strlen(namebuf)], "%02d:%02d:%02d)", tottime / 3600, (tottime % 3600) / 60, tottime % 60);
  // replay description, maybe we'll use this later
  fgetstring_limit (buffer, in, 99);

  if (buffer[0] == 0)
    strcpy (buffer, "No description");

  strcat (namebuf, ": ");
  strcat (namebuf, buffer);
  fclose (in);

}
Esempio n. 11
0
void grafo::KRUSKAL(void)
{
 // pesquisa entre as arestas não ligadas a com menor peso e que não gere loop
 vector<bool> AuX(size());
 vector<vector<bool> > AUX(size());

 num N=size();

 for( num k=0; k<size()-1; k++) {
  AUX[k]=vector<bool>(size());
  for( num t=k+1; t<size(); t++)
   if(connected(k,t)) {
    AUX[k][t]=AUX[t][k]=AuX[k]=AuX[t]=true;
    N-=2;
   }
 }

 while(N>0)
// for( num s=0; s<100*199; s++)
 { 
  vector<bool> Aux(size());
  weight aux=INF;
  vertex v=0, w=0;

  for( num i=0; i<size()-1; i++)
   for( num j=i+1; j<size(); j++)
    if( !AUX[i][j] & getw(i,j) < aux) {
     aux=getw(i,j);
     v=i; w=j;
   }
//  cout << v << "->" << w << " " << aux << endl;

  if(aux==INF) return;

  AUX[v][w]=AUX[w][v]=true;
  insert(v, w);
//  cout << endl << "check loop" << endl;
  if(in_loop(v, v, v, Aux) ) {
//  if( !AuX[v] | !AuX[w]) 
//   insert(v,w);
//   cout << "loop" << endl;
   remove(v,w);
  }
//  else
//   continue;
//  cout << endl << "end ckeck loop" << endl;
  if( !AuX[v]) N--;
  if( !AuX[w]) N--;
  AuX[v]=AuX[w]=true;
//  for( num s=0; s<size(); s++)
//   cout << AuX[s];
//  cout << endl;
//  cout << k << endl;
 }
}
Esempio n. 12
0
int	dochunk(FILE *f1)
{
	unsigned u;
	int	a,b,c;
	long	chunkstart;
	chunkstart=ftell(f1);
	fread(&chunkheader,sizeof(chunkheader),1,f1);
	switch(chunkheader.type)
	{
		case 11 : /* FLI_COLOR */
			c=getw(f1);
			a=0;
			while(c--)
			{
				a+=getc(f1);
				b=getc(f1); if(!b) b=256;
				outp(0x3c8,a);
				while(b--)
				{
					outp(0x3c9,getc(f1));
					outp(0x3c9,getc(f1));
					outp(0x3c9,getc(f1));
				}
			}
			break;
		case 12 : /* FLI_LC */
			u=getw(f1)*lw;
			c=getw(f1);
			while(c--)
			{
				doline1(u,f1);
				u+=lw;
			}
			break;
		case 13 : /* FLI_BLACK */
			memset(vram,0,64000U);
			break;
		case 15 : /* FLI_BRUN */
			u=0;
			c=200;
			while(c--)
			{
				doline2(u,f1);
				u+=lw;
			}
			break;
		case 16 : /* FLI_COPY */
			fread(buf,1,64000U,f1);
			memcpy(vram,buf,64000U);
			break;
	}
	fseek(f1,chunkstart+chunkheader.size,SEEK_SET);
	return(0);
}
Esempio n. 13
0
// Load preference.
void loadPreference() {
  FILE *fp;
  int i, j;
  int version;
#ifdef MACOSX
  if ( NULL == (fp = fopen(pathToPrefFile,"rb")) ) {
#else
  if ( NULL == (fp = fopen(PREF_FILE,"rb")) ) {
#endif
    initHiScore();
    return;
  }
  version = getw(fp);
  if ( version != VERSION_NUM ) {
    initHiScore();
    return;
  }
  for ( i=0 ; i<STAGE_NUM ; i++ ) {
    hiScore.stageScore[i] = getw(fp);
    for ( j=0 ; j<SCENE_NUM ; j++ ) {
      hiScore.sceneScore[i][j] = getw(fp);
    }
  }
  for ( i=0 ; i<ENDLESS_STAGE_NUM ; i++ ) {
    hiScore.stageScore[i+STAGE_NUM] = getw(fp);
  }
  hiScore.stage = getw(fp);
  fclose(fp);
}

// Save preference.
void savePreference() {
  FILE *fp;
  int i, j;
#ifdef MACOSX
  if ( NULL == (fp = fopen(pathToPrefFile,"wb")) ) return;
#else
  if ( NULL == (fp = fopen(PREF_FILE,"wb")) ) return;
#endif
  putw(VERSION_NUM, fp);
  for ( i=0 ; i<STAGE_NUM ; i++ ) {
    putw(hiScore.stageScore[i], fp);
    for ( j=0 ; j<SCENE_NUM ; j++ ) {
      putw(hiScore.sceneScore[i][j], fp);
    }
  }
  for ( i=0 ; i<ENDLESS_STAGE_NUM ; i++ ) {
    putw(hiScore.stageScore[i+STAGE_NUM], fp);
  }
  putw(hiScore.stage, fp);
  fclose(fp);
}
Esempio n. 14
0
  void
readSourceFileLine(int *sourceAddressPtr, int *sourceDepthPtr, char *lineBuffer, FILE *file)
{
	char	c;

	*sourceAddressPtr = getw(file);
	*sourceDepthPtr = getw(file);
	myfgets(lineBuffer, LINE_BUFFER_SIZE, file);
	if (longLineFlag) {
		while ((c = getc(file)) != '\n' &&  c != EOF)
			;
		lineBuffer[LINE_BUFFER_SIZE - 2] = '\n';
	}
}
Esempio n. 15
0
void AGSPlatformDriver::ReadPluginsFromDisk(FILE *iii) {
  if (getw(iii) != 1)
    quit("ERROR: unable to load game, invalid version of plugin data");

  int numPlug = getw(iii), a, datasize;
  char buffer[80];

  for (a = 0; a < numPlug; a++) {
    // read the plugin name
    fgetstring (buffer, iii);
    datasize = getw(iii);
    fseek (iii, datasize, SEEK_CUR);
  }

}
Esempio n. 16
0
void main(void)
 { 
   FILE *fp;

   int word;

   if ((fp = fopen("DATA.DAT", "wb")) == NULL)
     {
       printf("Error opening DATA.DAT for output\n");
       exit(1);
     }
   else
     {
       for (word = 1; word <= 100; word++)
         putw(word, fp);
       fclose(fp);
     }

   if ((fp = fopen("DATA.DAT", "rb")) == NULL)
     {
       printf("Error opening DATA.DAT for input\n");
       exit(1);
     }
   else
     {
       do {
         word = getw(fp); 
         if ((word == EOF) && (feof(fp)))
           break;
         else
           printf("%d ", word);
       } while (1);
       fclose(fp);
     }
 }
Esempio n. 17
0
int main()
{
	char *filename;
	FILE *f1,*f2;
	int i,number;
	f1=fopen("TEST","w");
	for(i=10;i<=100;i++)
	{
		putw(i,f1);
	}
	fclose(f1);
	printf("\nInput filename\n");
	open_file:
	scanf("%s",filename);
	if((f2=fopen(filename,"r"))==NULL)
	{
		printf("Can not open the file.\n");
		printf("Type filena,e again.\n");
		goto open_file;
	}
	else
	for(i=1;i<=20;i++)
	{
		number=getw(f2);
		if(feof(f2))
		{
			printf("Ran out of data.\n");
			break;
		}
		else 
		printf("%d\n",number);
	}
	fclose(f2);
}
Esempio n. 18
0
main()  {
	int a,b;
	FILE    *f1,*f2,*f3;

	if(_argc!=2)
		{
		printf("usage: %s <file.exe>\n");
		exit(1);
		}

	f1=fopen(_argv[1],"rb");
	if(f1==0) exit(1);
	f2=fopen("exebody.dat","wb");
	if(f2==0) exit(1);
	f3=fopen("exehead.dat","wb");
	if(f3==0) exit(1);

	fread(buf,1,0x1c,f1);
	fwrite(buf,1,0x1c,f3);

	fseek(f1,0x08,SEEK_SET);
	fseek(f1,a=getw(f1)*16,SEEK_SET);

	while(!feof(f1))
		{
		a=fread(buf,1,16384,f1);
		if(a==0) break;
		fwrite(buf,1,a,f2);
		}
	}
Esempio n. 19
0
int
openholo(		/* open existing holodeck file for i/o */
	char	*fname,
	int	append
)
{
	FILE	*fp;
	int	fd;
	int	hflags = 0;
	off_t	nextloc;
	int	n;
					/* open holodeck file */
	if ((fp = fopen(fname, append ? "r+" : "r")) == NULL) {
		sprintf(errmsg, "cannot open \"%s\" for %s", fname,
				append ? "appending" : "reading");
		error(SYSTEM, errmsg);
	}
					/* check header and magic number */
	if (getheader(fp, holheadline, &hflags) < 0 ||
			hflags&H_BADF || getw(fp) != HOLOMAGIC) {
		sprintf(errmsg, "file \"%s\" not in holodeck format", fname);
		error(USER, errmsg);
	}
	fd = dup(fileno(fp));			/* dup file handle */
	nextloc = ftell(fp);			/* get stdio position */
	fclose(fp);				/* done with stdio */
	for (n = 0; nextloc > 0L; n++) {	/* initialize each section */
		lseek(fd, nextloc, SEEK_SET);
		read(fd, (char *)&nextloc, sizeof(nextloc));
		hdinit(fd, NULL)->priv = hflags&H_OBST ? &obstr :
				hflags&H_OBSF ? &unobstr : (char *)NULL;
	}
	return(n);
}
Esempio n. 20
0
void ReadJAFont( char *filename, jafont_t font[256], jahead_t head )
{
	FILE *fp;
	fp = fopen(filename, "rb");
	int i;
	i = 32;
	fseek( fp, 896, SEEK_SET );
	while( i < 255 )
	{
		font[i].phWidth = gets( fp );
		font[i].phHeight = gets( fp );
		font[i].hAdv = gets( fp );
		font[i].hOfs = gets( fp );
		font[i].baseline = getw( fp );
		font[i].st1[0] = getf( fp );
		font[i].st1[1] = getf( fp );
		font[i].st2[0] = getf( fp );
		font[i].st2[1] = getf( fp );
		i++;
	}
	head.mPointSize = gets( fp );
	head.mHeight = gets( fp );
	head.mAscender = gets( fp );
	head.mDescender = gets( fp );
	head.mKoreanHack = gets( fp );
	fclose( fp );
}
void Enemy::update1()
{
	if (!air)
	{
		// check if we are moving onto empty space
		TEG_MAP *map = parent->getMap();
		int xx = x + ((dx > 0) ? getw() : 0);
		int yy = y + geth() + 1;
		int mx = xx / map->tilelist->tilew;
		int my = yy / map->tilelist->tileh;

		int tileflags = getTileStackFlags(mx, my);
		if ((tileflags & TS_SOLID) == 0)
		{
			// turn around
			dx = -dx;
		}
	}

	if (bulletTimer >=  301)
	{
		spawn(EBullet::ENERGY);
		bulletTimer = 0;
	}
	else
	{
		bulletTimer++;
	}
}
void main()
{
 FILE *f,*f2;
 int c,i,m,n,a[11],b[11],j;
 clrscr();
 printf("key(ten digits with spaces ;no two digits same)  ");
 for(i=1;i<=10;i++)
 scanf("%d",&a[i]);
 for(i=6,j=1;i<=10;i++,j++)
 b[j]=a[i];
 for(i=1,j=6;i<=5;i++,j++)
 b[j]=a[i];
 for(i=1;i<=10;i++)
 b[i]=b[i]*2;
 f=fopen("nature.jpg","rb");
 f2=fopen("b.jpg","wb");

 for(j=1;j<=10;j++)
 {
 fseek(f,b[j]*1000,0);
 for(i=1;i<=1000;i++)
 {
 c=getw(f);
 putw(c,f2);
 }
 }
 fclose(f);
 fclose(f2);
 getch();
}
Esempio n. 23
0
static int
comm_getcur(			/* get and return cursor position */
	int	*xp,
	int	*yp
)
{
	int	c;

	putc(COM_GETCUR, devout);
	fflush(devout);
	if (getc(devin) != COM_GETCUR)
		reply_error("getcur");
	c = getc(devin);
	*xp = getw(devin);
	*yp = getw(devin);
	return(c);
}
Esempio n. 24
0
/* *** SCRIPT SYMBOL: [File] FileReadInt *** */
static int FileReadInt(FILE*haa) {
  check_valid_file_handle(haa,"FileReadInt");
  if (feof(haa))
    return -1;
  if (fgetc(haa)!='I')
    quit("!FileReadInt: File read back in wrong order");
  return getw(haa);
  }
Esempio n. 25
0
  void
readIndexFileLine(statementKindType *statementKindPtr, int *indexAddressPtr, int *indexLineNumberPtr)
{
	statementKindType	 statementKindRead;
	int			 indexAddressRead;
	int			 indexLineNumberRead;

	statementKindRead = (statementKindType) getw(indexFileForPass2);
	indexAddressRead = getw(indexFileForPass2);
	indexLineNumberRead = getw(indexFileForPass2) - 1;
	if (!feof(indexFileForPass2)) {
		*statementKindPtr = statementKindRead;
		*indexAddressPtr = indexAddressRead;
		*indexLineNumberPtr = indexLineNumberRead;
	} else {
		*indexLineNumberPtr += 1;
	}
}
Esempio n. 26
0
main() {
//y x = {25,10,10,1000};
FILE *fp = fopen("test","rb");
//fwrite(&x,sizeof(y),1,fp);

int x1;
x1 = getw(fp);
printf("%d",x1);
}
void read(FILE *fp1)// To read file data from data space
{
	int a,b,c,d,e;
	char g,namre[15],m,re[100];
	printf("\nEnter the name of the file with extension you want to read\n");
	g=getchar();
	gets(namre);
	printf("Enter no.of characters you want to read\n");
	scanf("%d",&e);
	a=search_f(namre);
	if(a==1)
	{
		printf("\nFile does not exist\n");
	}
	else
	{
		fseek(fp1,a+31,0);
		fread(&m,1,1,fp1);
		if(m=='w')
		{
			printf("\nUser has write only permisssion so can't read\n");
		}
		else
		{
			fseek(fp1,a+26,0);
			b=getw(fp1);
			fseek(fp1,b,0);
			c=getw(fp1);
			if(c==0)
			printf("\nFile is empty\n");
			else
			{
			fseek(fp1,c,0);
			fread(re,e,1,fp1);
			printf("%s\n",re);
			}
		}	

	}
	
	
	
}
Esempio n. 28
0
bool String::readFromFile(FILE *file)
{
    int flen=getw(file);
    if (flen<0) return false;
    resize(flen);
    for (int a=0; a<flen; a++)
    {
        buf[a]=fgetc(file);
    }
    return true;
}
Esempio n. 29
0
void testValues() {
    f = 2;
    
    FILE* file = VALID_FILE;
    if (file != NULL) {
        getw(file);
    }

    //@ assert f == 2;
    //@ assert vacuous: \false;
}
Esempio n. 30
0
/* *** SCRIPT SYMBOL: [File] FileRead *** */
static void FileRead(FILE*haa,char*toread) {
  VALIDATE_STRING(toread);
  check_valid_file_handle(haa,"FileRead");
  if (feof(haa)) {
    toread[0] = 0;
    return;
  }
  int lle=getw(haa);
  if ((lle>=200) | (lle<1)) quit("!FileRead: file was not written by FileWrite");
  fread(toread,lle,1,haa);
  }