components/prboom/m_misc.c
/*
 * M_ReadFile
 *
 * killough 9/98: rewritten to use stdio and to flash disk icon
 */
M_ReadFile
killough 9/98: rewritten to use stdio and to flash disk icon
M_ReadFile killough 9 / 98 : rewritten to use stdio and to flash disk icon
int M_ReadFile(char const *name, byte **buffer)
{
  FILE *fp;
  lprintf(LO_WARN, "Attempting M_ReadFile %s\n", name);
  return -1;
  if ((fp = fopen(name, "rb")))
    {
      size_t length;
      I_BeginRead();
      fseek(fp, 0, SEEK_END);
      length = ftell(fp);
      fseek(fp, 0, SEEK_SET);
      *buffer = Z_Malloc(length, PU_STATIC, 0);
      if (fread(*buffer, 1, length, fp) == length)
        {
          fclose(fp);
          I_EndRead();
          return length;
        }
      fclose(fp);
    }
  return -1;
}
int M_ReadFile ( char const * name , byte * * buffer ) { FILE * fp ; lprintf ( LO_WARN , " \n " , name ) ; return -1 ; if ( ( fp = fopen ( name , " " ) ) ) { size_t length ; I_BeginRead ( ) ; fseek ( fp , 0 , SEEK_END ) ; length = ftell ( fp ) ; fseek ( fp , 0 , SEEK_SET ) ; * buffer = Z_Malloc ( length , PU_STATIC , 0 ) ; if ( fread ( * buffer , 1 , length , fp ) == length ) { fclose ( fp ) ; I_EndRead ( ) ; return length ; } fclose ( fp ) ; } return -1 ; }
M_ReadFile
 killough 9/98: rewritten to use stdio and to flash disk icon
M_ReadFile killough 9 / 98 : rewritten to use stdio and to flash disk icon
/* cph 2002/08/10 - this used to return 0 on error, but that's ambiguous,
   * because we could have a legit 0-length file. So make it -1. */