/** No descriptions */ int CachedFileStream::ReadLine(void* buf, unsigned int maxlen) { if (!maxlen) { return 0; } unsigned char * p = ( unsigned char * ) buf; if (_feof( str )) { p[0]=0; return -1; } if (Pos >= size) { p[0]=0; return -1; } unsigned int i = 0; while (i < ( maxlen - 1 )) { int ch = _fgetc( str ); if (Pos == size) break; if (Encrypted) ch ^= GEM_ENCRYPTION_KEY[Pos & 63]; Pos++; if (( ( char ) ch ) == '\n') break; if (( ( char ) ch ) == '\t') ch = ' '; if (( ( char ) ch ) != '\r') p[i++] = ch; //Warning:this feof implementation reads forward one byte if (_feof( str )) break; } p[i] = 0; return i; }
int fgetc(FILE *__stream) { //printf("INTERCEPTED Fgetc\n"); clock_t start = clock(); int ret = _fgetc(__stream); clock_t end = clock(); double called_time = (double)(start-program_start)/(double)(CLOCKS_PER_SEC); double exec_time = (double)(end-start)/(double)(CLOCKS_PER_SEC); fprintf(logFile,"%lf %lf fgetc %p = %d\n",called_time,exec_time,__stream,ret); return ret; }