CFILE.H 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
  12. */
  13. /*
  14. * $Source: f:/miner/source/cfile/rcs/cfile.h $
  15. * $Revision: 1.10 $
  16. * $Author: john $
  17. * $Date: 1995/03/13 15:16:47 $
  18. *
  19. * Prototypes for compressed file functions...
  20. *
  21. * $Log: cfile.h $
  22. * Revision 1.10 1995/03/13 15:16:47 john
  23. * Added alternate directory stuff.
  24. *
  25. * Revision 1.9 1995/02/01 20:56:40 john
  26. * Added cfexist function
  27. *
  28. * Revision 1.8 1995/01/21 17:53:41 john
  29. * Added alternate pig file thing.
  30. *
  31. * Revision 1.7 1994/12/12 13:19:47 john
  32. * Made cfile work with fiellentth.
  33. *
  34. * Revision 1.6 1994/12/08 19:02:52 john
  35. * Added cfgets.
  36. *
  37. * Revision 1.5 1994/12/07 21:34:07 john
  38. * Stripped out compression stuff...
  39. *
  40. * Revision 1.4 1994/07/13 00:16:53 matt
  41. * Added include
  42. *
  43. * Revision 1.3 1994/02/17 17:36:19 john
  44. * Added CF_READ_MODE and CF_WRITE_MODE constants.
  45. *
  46. * Revision 1.2 1994/02/15 12:52:08 john
  47. * Crappy inbetween version
  48. *
  49. * Revision 1.1 1994/02/15 10:54:23 john
  50. * Initial revision
  51. *
  52. * Revision 1.1 1994/02/10 15:50:54 john
  53. * Initial revision
  54. *
  55. *
  56. */
  57. #ifndef _CFILE_H
  58. #define _CFILE_H
  59. #include <stdio.h>
  60. typedef struct CFILE {
  61. FILE *file;
  62. int size;
  63. int lib_offset;
  64. int raw_position;
  65. } CFILE;
  66. CFILE * cfopen(char * filename, char * mode);
  67. int cfilelength( CFILE *fp ); // Returns actual size of file...
  68. size_t cfread( void * buf, size_t elsize, size_t nelem, CFILE * fp );
  69. void cfclose( CFILE * cfile );
  70. int cfgetc( CFILE * fp );
  71. int cfseek( CFILE *fp, long int offset, int where );
  72. int cftell( CFILE * fp );
  73. char * cfgets( char * buf, size_t n, CFILE * fp );
  74. int cfexist( char * filename ); // Returns true if file exists on disk (1) or in hog (2).
  75. // Allows files to be gotten from an alternate hog file.
  76. // Passing NULL disables this.
  77. void cfile_use_alternate_hogfile( char * name );
  78. // All cfile functions will check this directory if no file exists
  79. // in the current directory.
  80. void cfile_use_alternate_hogdir( char * path );
  81. #endif
  82.