Computer Chess Club Archives


Search

Terms

Messages

Subject: Off topic: problems with fread in MVC

Author: Carlos del Cacho

Date: 12:55:51 10/05/00



Okay, I know I shouldn't post this kind of stuff... but somebody out there can
help me ? I've ported Pepito to MVC recently and everything is working fine
except reading opening book to memory. MVC's executable just reads 11 book
entries in a file where there's more thatn 120000 ?! ferror() doesn't report
anything. This junk works in GCC quite well. Here's the code:


#define           ADD_INC   5  // we're reading it in chunks. GCC can read
                               // entire book in one swoop but it wouldn't
                               // compile with MVC6.

                  ... after opening book file (stream fich)

                  int count = ADD_INC;
                  entrada_hash *t;  // pointer to hash_entry type (book is
                                    // in transposition table)
		  printf("Book loaded.\n");
		  fseek(fich,0L,SEEK_SET);

                  // tab.trans_tab is the pointer that contains initial mem
                  // address of the transposition table

		  for (tab.book_size = 0, t = tab.trans_tab; count == ADD_INC;
                       t+= ADD_INC)
                  {
		    count = fread((void*)t,(size_t)sizeof
                            (entrada_hash),ADD_INC,fich);
		    tab.book_size += count; // stores total num of book entries
		    printf("Reading chunk %d\n",count);
                    if (ferror(fich))
	              perror("Error: ");
		  }


Help!!!
Carlos del Cacho



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.