Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. char * xbuf;
  5. unsigned long sz;
  6.  
  7. int main(void)
  8. {
  9.  FILE * fp;
  10.  chdir("/hd/1/menuetos/doom");
  11.  __libclog_printf("Opening file ...");
  12.  fp=fopen("doom1.wad","rb");
  13.  if(!fp)
  14.  {
  15.   __libclog_printf("failed\n");
  16.   return 1;
  17.  }
  18.  __libclog_printf("OK\n");
  19.  fseek(fp,0,SEEK_END);
  20.  sz=ftell(fp);
  21.  fseek(fp,0,SEEK_SET);
  22.  xbuf=malloc(sz);
  23.  if(!xbuf)
  24.  {
  25.   __libclog_printf("Unable to malloc %u bytes\n",sz);
  26.   return 1;
  27.  }
  28.  __libclog_printf("Reading ...");
  29.  fread(xbuf,1,sz,fp);
  30.  __libclog_printf("done\n");
  31.  fclose(fp);
  32.  return 0;
  33. }
  34.