physfs.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. /**
  2. * PhysicsFS; a portable, flexible file i/o abstraction.
  3. *
  4. * This API gives you access to a system file system in ways superior to the
  5. * stdio or system i/o calls. The brief benefits:
  6. *
  7. * - It's portable.
  8. * - It can handle byte ordering on alternative processors.
  9. * - It's safe. No file access is permitted outside the specified dirs.
  10. * - It's flexible. Archives (.ZIP files) can be used transparently as
  11. * directory structures.
  12. *
  13. * This system is largely inspired by Quake 3's PK3 files and the related
  14. * fs_* cvars. If you've ever tinkered with these, then this API will be very
  15. * familiar to you.
  16. *
  17. * With the PhysicsFS, you have a single writing directory and multiple
  18. * "search paths" for reading. You can think of this as a filesystem within a
  19. * filesystem. If (on Windows) you were to set the writing directory to
  20. * "C:\MyGame\MyWritingDirectory", then no PHYSFS calls could touch anything
  21. * above this directory, including the "C:\MyGame" and "C:\" directories.
  22. * This prevents an application's internal scripting language from piddling
  23. * over c:\config.sys, for example. If you'd rather give PHYSFS full access
  24. * to the system's REAL file system, set the writing path to "C:\", but
  25. * that's generally A Bad Thing for several reasons.
  26. *
  27. * Drive letters are hidden in PhysicsFS once you set up your initial paths.
  28. * The search paths create a single, hierarchical directory structure.
  29. * Not only does this lend itself well to general abstraction with archives,
  30. * it also gives better support to operating systems like MacOS and Unix.
  31. * Generally speaking, you shouldn't ever hardcode a drive letter; not only
  32. * does this hurt portability to non-Microsoft OSes, but it limits your win32
  33. * users to a single drive, too. Use the PhysicsFS abstraction functions and
  34. * allow user-defined configuration options, too. When opening a file, you
  35. * specify it like it was on a Unix filesystem: if you want to write to
  36. * "C:\MyGame\MyConfigFiles\game.cfg", then you might set the write path to
  37. * "C:\MyGame" and then open "MyConfigFiles/game.cfg". This gives an
  38. * abstraction across all platforms.
  39. *
  40. * All files opened for writing are opened in relation to the write path,
  41. * which is the root of the writable filesystem. When opening a file for
  42. * reading, PhysicsFS goes through it's internal search path. This is NOT the
  43. * same thing as the PATH environment variable. An application using
  44. * PhysicsFS specifies directories to be searched which may be actual
  45. * directories, or archive files that contain files and subdirectories of
  46. * their own. See the end of these docs for currently supported archive
  47. * formats.
  48. *
  49. * Once a search path is defined, you may open files for reading. If you've
  50. * got the following search path defined (to use a win32 example again):
  51. *
  52. * C:\mygame
  53. * C:\mygame\myuserfiles
  54. * D:\mygamescdromdatafiles
  55. * C:\mygame\installeddatafiles.zip
  56. *
  57. * Then a call to PHYSFS_openread("textfiles/myfile.txt") (note the directory
  58. * separator) will check for C:\mygame\textfiles\myfile.txt, then
  59. * C:\mygame\myuserfiles\textfiles\myfile.txt, then
  60. * D:\mygamescdromdatafiles\textfiles\myfile.txt, then, finally, for
  61. * textfiles\myfile.txt inside of C:\mygame\installeddatafiles.zip. Remember
  62. * that most archive types and platform filesystems store their filenames in
  63. * a case-sensitive manner.
  64. *
  65. * Files opened through PhysicsFS may NOT contain "." or ".." as path
  66. * elements. Not only are these meaningless on MacOS, they are a security
  67. * hole. Also, symbolic links (which can be found in some archive types and
  68. * directly in the filesystem on Unix platforms) are NOT followed until you
  69. * call PHYSFS_permitSymbolicLinks(). That's left to your own discretion, as
  70. * following a symlink can allow for access outside the write and search
  71. * paths. There is no mechanism for creating new symlinks in PhysicsFS.
  72. *
  73. * The write path is not included in the search path unless you specifically
  74. * add it. While you CAN change the write path as many times as you like,
  75. * you should probably set it once and stick to that path.
  76. *
  77. * All files are opened in binary mode; there is no endline conversion for
  78. * textfiles. Other than that, PhysicsFS has some convenience functions for
  79. * platform-independence. There are functions that give you the current
  80. * platform's path separator ("\\" on windows, "/" on Unix, ":" on MacOS),
  81. * which is needed only to set up your search/write paths. There are
  82. * functions to tell you what CD-ROM drives contain accessible discs, and
  83. * functions to recommend good search paths, etc. There are also functions
  84. * to read 16 and 32 bit numbers from files and convert them to the native
  85. * byte order of your processor.
  86. *
  87. * A recommended order for a search path is the write path, then the base path,
  88. * then the cdrom path, then any archives discovered. Quake 3 does something
  89. * like this, but moves the archives to the start of the search path. There
  90. * is a helper function (PHYSFS_setSanePaths()) that does this for you,
  91. * based on a few parameters. Also see the comments on PHYSFS_getBasePath(),
  92. * and PHYSFS_getUserPath() for info on what those are and how they can help
  93. * you determine an optimal searchpath.
  94. *
  95. * While you CAN mix stdio/syscall file access with PHYSFS_* calls in a
  96. * program, doing so is not recommended, and you can not use system
  97. * filehandles with PhysicsFS filehandles and vice versa.
  98. *
  99. * Note that archives need not be named as such: if you have a ZIP file and
  100. * rename it with a .PKG extention, the file will still be recognized as a
  101. * ZIP archive by PhysicsFS; the file's contents are used to determine its
  102. * type.
  103. *
  104. * Currently supported archive types:
  105. * - .ZIP (pkZip/WinZip/Info-ZIP compatible)
  106. *
  107. * Please see the file LICENSE in the source's root directory.
  108. *
  109. * This file written by Ryan C. Gordon.
  110. */
  111. #ifndef _INCLUDE_PHYSFS_H_
  112. #define _INCLUDE_PHYSFS_H_
  113. #ifdef __cplusplus
  114. extern "C" {
  115. #endif
  116. /* functions... */
  117. /**
  118. * Get the last PhysicsFS error message as a null-terminated string.
  119. * This will be NULL if there's been no error since the last call to this
  120. * function. The pointer returned by this call points to a static buffer
  121. * internal buffer, and this call is not thread safe.
  122. *
  123. * @return READ ONLY string of last error message.
  124. */
  125. const char *PHYSFS_getLastError(void);
  126. /**
  127. * Get a platform-dependent path separator. This is "\\" on win32, "/" on Unix,
  128. * and ":" on MacOS. It may be more than one character, depending on the
  129. * platform, and your code should take that into account. Note that this is
  130. * only useful for setting up the search/write paths, since access into those
  131. * paths always use '/' to separate directories. This is also handy for
  132. * getting platform-independent access when using stdio calls.
  133. *
  134. * @return READ ONLY null-terminated string of platform's path separator.
  135. */
  136. const char *PHYSFS_getPathSeparator(void);
  137. /**
  138. * Get an array of paths to available CD-ROM drives. This return value should
  139. * be considered READ ONLY and points to an internal buffer which may change
  140. * with each call to this function. This means that this function is NOT
  141. * thread safe.
  142. *
  143. * The paths returned are platform-dependent ("D:\" on Win32, "/cdrom" or
  144. * whatnot on Unix). Paths are only returned if there is a disc ready and
  145. * accessible in the drive. So if you've got two drives (D: and E:), and only
  146. * E: has a disc in it, then that's all you get. If the user inserts a disc
  147. * in D: and you call this function again, you get both drives. If, on a
  148. * Unix box, the user unmounts a disc and remounts it elsewhere, the next
  149. * call to this function will reflect that change. Fun.
  150. *
  151. * The returned value is an array of strings, with a NULL entry to signify the
  152. * end of the list:
  153. *
  154. * char **i;
  155. *
  156. * // lock thread here, if needed.
  157. *
  158. * for (i = PHYSFS__getCdRomPaths(); *i != NULL; i++)
  159. * printf("cdrom path [%s] is available.\n", *i);
  160. *
  161. * // unlock thread here, if needed.
  162. *
  163. * This call may block while drives spin up. Be forewarned.
  164. *
  165. * @return READ ONLY null-term'd array of READ ONLY null-terminated strings.
  166. */
  167. const char **PHYSFS_getCdRomPaths(void);
  168. /**
  169. * Helper function.
  170. *
  171. * Get the "base path". This is the directory where the application was run
  172. * from, which is probably the installation directory.
  173. *
  174. * You should probably use the base path in your search path.
  175. *
  176. * @param buffer pointer to buffer to fill with recommended path.
  177. * @param bufsize size of buffer pointed to by (buffer).
  178. * @return a copy of (buffer), for easy use as another function's parameter.
  179. */
  180. char *PHYSFS_getBasePath(char *buffer, int bufferSize);
  181. /**
  182. * Helper function.
  183. *
  184. * Get the "user path". This is meant to be a suggestion of where a specific
  185. * user of the system can store files. On Unix, this is her home directory.
  186. * On systems with no concept of multiple users (MacOS, win95), this will
  187. * default to the "base path" returned by PHYSFS_getBasePath().
  188. *
  189. * You should probably use the user path as the basis for your write path, and
  190. * also put it near the beginning of your search path.
  191. *
  192. * @param buffer pointer to buffer to fill with recommended path.
  193. * @param bufsize size of buffer pointed to by (buffer).
  194. * @return a copy of (buffer), for easy use as another function's parameter.
  195. */
  196. char *PHYSFS_getUserPath(char *buffer, int bufferSize);
  197. /**
  198. * Get the current write path. The default write path is NULL.
  199. *
  200. * @param buffer pointer to buffer to fill with recommended path.
  201. * @param bufsize size of buffer pointed to by (buffer).
  202. * @return a copy of (buffer), for easy use as another function's parameter,
  203. * OR NULL IF NO WRITE PATH IS CURRENTLY SET.
  204. */
  205. char *PHYSFS_getWritePath(char *buffer, int bufferSize);
  206. /**
  207. * Set a new write path. This will override the previous setting. If the
  208. * directory or a parent directory doesn't exist in the physical filesystem,
  209. * PhysicsFS will attempt to create them as needed.
  210. *
  211. * This call will fail (and fail to change the write path) if the current path
  212. * still has files open in it.
  213. *
  214. * @param newPath The new directory to be the root of the write path,
  215. * specified in a platform-dependent manner. Setting to NULL
  216. * disables the write path, so no files can be opened for
  217. * writing via PhysicsFS.
  218. * @return non-zero on success, zero on failure. All attempts to open a file
  219. * for writing via PhysicsFS will fail until this call succeeds.
  220. * Specifics of the error can be gleaned from PHYSFS_getLastError().
  221. *
  222. */
  223. int PHYSFS_setWritePath(const char *newPath);
  224. /**
  225. * Add a directory or archive to the search path. If this is a duplicate, the
  226. * entry is not added again, even though the function succeeds.
  227. *
  228. * @param newPath directory or archive to add to the path, in
  229. * platform-dependent notation.
  230. * @param appendToPath nonzero to append to search path, zero to prepend.
  231. * @return nonzero if added to path, zero on failure (bogus archive, path
  232. * missing, etc). Specifics of the error can be
  233. * gleaned from PHYSFS_getLastError().
  234. */
  235. int PHYSFS_addToSearchPath(const char *newPath, int appendToPath);
  236. /**
  237. * Remove a directory or archive to the search path.
  238. *
  239. * This must be a (case-sensitive) match to a dir or archive already in the
  240. * search path, specified in platform-dependent notation.
  241. *
  242. * This call will fail (and fail to remove from the path) if the element still
  243. * has files open in it.
  244. *
  245. * @param oldPath dir/archive to remove.
  246. * @return nonzero on success, zero on failure.
  247. * Specifics of the error can be gleaned from PHYSFS_getLastError().
  248. */
  249. int PHYSFS_removeFromSearchPath(const char *oldPath);
  250. /**
  251. * Get the current search path. The default search path is an empty list.
  252. *
  253. * This return value should be considered READ ONLY and points to an internal
  254. * buffer which may change with each call to this function. This means that
  255. * this function is NOT thread safe.
  256. *
  257. * The returned value is an array of strings, with a NULL entry to signify the
  258. * end of the list:
  259. *
  260. * char **i;
  261. *
  262. * // lock thread here, if needed.
  263. *
  264. * for (i = PHYSFS_getSearchPath(); *i != NULL; i++)
  265. * printf("[%s] is in the search path.\n", *i);
  266. *
  267. * // unlock thread here, if needed.
  268. *
  269. * @return READ ONLY null-term'd array of READ ONLY null-terminated strings.
  270. */
  271. const char **PHYSFS_getSearchPath(void);
  272. /**
  273. * Helper function.
  274. *
  275. * Set up sane, default paths. The write path will be set to
  276. * "userpath/.appName", which is created if it doesn't exist.
  277. *
  278. * The above is sufficient to make sure your program's configuration directory
  279. * is separated from other clutter, and platform-independent. The period
  280. * before "mygame" even hides the directory on Unix systems.
  281. *
  282. * The search path will be:
  283. *
  284. * - The Write Path
  285. * - The Write Path/appName
  286. * - The Base Path (PHYSFS_getBasePath())
  287. * - The Base Path/appName
  288. * - All found CD-ROM paths (optionally)
  289. * - All found CD-ROM paths/appName (optionally)
  290. *
  291. * These directories are then searched for files ending with the extension
  292. * (archiveExt), which, if they are valid and supported archives, will also
  293. * be added to the search path. If you specified "PKG" for (archiveExt), and
  294. * there's a file named data.PKG in the base dir, it'll be checked. Archives
  295. * can either be appended or prepended to the search path in alphabetical
  296. * order, regardless of which directories they were found in.
  297. *
  298. * All of this can be accomplished from the application, but this just does it
  299. * all for you.
  300. *
  301. * @param appName Program-specific name of your program, to separate it
  302. * from other programs using PhysicsFS.
  303. *
  304. * @param archiveExt File extention used by your program to specify an
  305. * archive. For example, Quake 3 uses "pk3", even though
  306. * they are just zipfiles. Specify NULL to not dig out
  307. * archives automatically.
  308. *
  309. * @param includeCdRoms Non-zero to include CD-ROMs in the search path, and
  310. * search them for archives. This may cause a
  311. * significant amount of blocking while discs are
  312. * accessed, and if there are no discs in the drive
  313. * (or even not mounted on Unix systems), then they
  314. * may not be made available anyhow. You may want to
  315. * specify zero and handle the disc setup yourself.
  316. *
  317. * @param archivesFirst Non-zero to prepend the archives to the search path.
  318. * Zero to append them.
  319. */
  320. void PHYSFS_setSanePaths(const char *appName, const char *archiveExt,
  321. int includeCdRoms, int archivesFirst);
  322. /**
  323. * Create a directory. This is specified in platform-independent notation in
  324. * relation to the write path. All missing parent directories are also
  325. * created if they don't exist.
  326. *
  327. * So if you've got the write path set to "C:\mygame\writepath" and call
  328. * PHYSFS_mkdir("downloads/maps") then the directories
  329. * "C:\mygame\writepath\downloads" and "C:\mygame\writepath\downloads\maps"
  330. * will be created if possible.
  331. *
  332. * @param dirname New path to create.
  333. * @return nonzero on success, zero on error. Specifics of the error can be
  334. * gleaned from PHYSFS_getLastError().
  335. */
  336. int PHYSFS_mkdir(const char *dirName);
  337. /**
  338. * Delete a file or directory. This is specified in platform-independent
  339. * notation in relation to the write path.
  340. *
  341. * A directory must be empty before this call can delete it. If you need to
  342. * nuke a whole directory tree, use PHYSFS_deltree()...with care.
  343. *
  344. * So if you've got the write path set to "C:\mygame\writepath" and call
  345. * PHYSFS_delete("downloads/maps/level1.map") then the file
  346. * "C:\mygame\writepath\downloads\maps\level1.map" is removed from the
  347. * physical filesystem, if it exists and the operating system permits the
  348. * deletion.
  349. *
  350. * @param filename Filename to delete.
  351. * @return nonzero on success, zero on error. Specifics of the error can be
  352. * gleaned from PHYSFS_getLastError().
  353. */
  354. int PHYSFS_delete(const char *filename);
  355. /**
  356. * Delete a directory tree. This is specified in platform-independent
  357. * notation in relation to the write path.
  358. *
  359. * Be CAREFUL with this function; it will take out EVERYTHING under the
  360. * specified directory with extreme prejudice.
  361. *
  362. * If you specify a filename that is not a directory, PhysicsFS will attempt
  363. * to delete that single file.
  364. *
  365. * So if you've got the write path set to "C:\mygame\writepath" and call
  366. * PHYSFS_deltree("downloads/maps") then the directory
  367. * "C:\mygame\writepath\downloads\maps" and everything in it (including child
  368. * directories) is removed from the physical filesystem, if it exists and the
  369. * operating system permits the deletion.
  370. *
  371. * @param filename root of directory tree to delete.
  372. * @return nonzero on success, zero on error. Specifics of the error can be
  373. * gleaned from PHYSFS_getLastError().
  374. */
  375. int PHYSFS_deltree(const char *filename);
  376. /**
  377. * Enable symbolic links. Some physical filesystems and archives contain
  378. * files that are just pointers to other files. On the physical filesystem,
  379. * opening such a link will (transparently) open the file that is pointed to.
  380. *
  381. * By default, PhysicsFS will check if a file is really a symlink during open
  382. * calls and fail if it is. Otherwise, the link could take you outside the
  383. * write and search paths, and compromise security.
  384. *
  385. * If you want to take that risk, call this function with a non-zero parameter.
  386. * Note that this is more for sandboxing a program's scripting language, in
  387. * case untrusted scripts try to compromise the system. Generally speaking,
  388. * a user could very well have a legitimate reason to set up a symlink, so
  389. * unless you feel there's a specific danger in allowing them, you should
  390. * permit them.
  391. *
  392. * Symbolic link permission can be enabled or disabled at any time, and is
  393. * disabled by default.
  394. *
  395. * @param allow nonzero to permit symlinks, zero to deny linking.
  396. */
  397. void PHYSFS_permitSymbolicLinks(int allow);
  398. /**
  399. * Determine if a file exists. Just because it exists does NOT mean that you
  400. * will have access to read or write it.
  401. *
  402. * @param filename a file in platform-independent notation.
  403. * @param inWritePath nonzero to check write path, zero to check search path.
  404. * @return nonzero if exists, zero otherwise.
  405. */
  406. int PHYSFS_exists(const char *filename, int inWritePath);
  407. /**
  408. * Figure out where in the search path a file resides. The file is specified
  409. * in platform-independent notation. The returned filename will be the
  410. * element of the search path where the file was found, which may be a
  411. * directory, or an archive. Even if there are multiple matches in different
  412. * parts of the search path, only the first one found is used, just like
  413. * when opening a file.
  414. *
  415. * So, if you look for "maps/level1.map", and C:\mygame is in your search
  416. * path and C:\mygame\maps\level1.map exists, then buffer will be filled in
  417. * with "C:\mygame\maps\level1.map" and the function returns nonzero.
  418. *
  419. * @param buffer pointer to buffer to fill with path.
  420. * @param bufsize size of buffer pointed to by (buffer).
  421. * @param filename file to look for.
  422. * @return nonzero if file was found, zero otherwise. If found, (buffer)
  423. * will be filled in.
  424. */
  425. int PHYSFS_getRealPath(const char *filename, char *buffer, int bufSize);
  426. /**
  427. * Open a file for writing, in platform-independent notation and in relation
  428. * to the write path as the root of the writable filesystem. The specified
  429. * file is created if it doesn't exist. If it does exist, it is truncated to
  430. * zero bytes, and the writing offset is set to the start.
  431. *
  432. * @param filename File to open.
  433. * @return A valid PhysicsFS filehandle on success, NULL on error. Specifics
  434. * of the error can be gleaned from PHYSFS_getLastError().
  435. */
  436. void *PHYSFS_openWrite(const char *filename);
  437. /**
  438. * Open a file for writing, in platform-independent notation and in relation
  439. * to the write path as the root of the writable filesystem. The specified
  440. * file is created if it doesn't exist. If it does exist, the writing offset
  441. * is set to the end of the file, so the first write will be the byte after
  442. * the end.
  443. *
  444. * @param filename File to open.
  445. * @return A valid PhysicsFS filehandle on success, NULL on error. Specifics
  446. * of the error can be gleaned from PHYSFS_getLastError().
  447. */
  448. void *PHYSFS_openAppend(const char *filename);
  449. /**
  450. * Open a file for reading, in platform-independent notation. The search path
  451. * is checked one at a time until a matching file is found, in which case an
  452. * abstract filehandle is associated with it, and reading may be done.
  453. * The reading offset is set to the first byte of the file.
  454. *
  455. * @param filename File to open.
  456. * @return A valid PhysicsFS filehandle on success, NULL on error. Specifics
  457. * of the error can be gleaned from PHYSFS_getLastError().
  458. */
  459. void *PHYSFS_openRead(const char *filename);
  460. /**
  461. * Close a PhysicsFS filehandle. This call is capable of failing if the
  462. * operating system was buffering writes to this file, and (now forced to
  463. * write those changes to physical media) can not store the data for any
  464. * reason. In such a case, the filehandle stays open. A well-written program
  465. * should ALWAYS check the return value from the close call in addition to
  466. * every writing call!
  467. *
  468. * @param handle handle returned from PHYSFS_open*().
  469. * @return nonzero on success, zero on error. Specifics of the error can be
  470. * gleaned from PHYSFS_getLastError().
  471. */
  472. int PHYSFS_close(void *handle);
  473. /**
  474. * Read data from a PhysicsFS filehandle. The file must be opened for reading.
  475. *
  476. * @param handle handle returned from PHYSFS_openRead().
  477. * @param buffer buffer to store read data into.
  478. * @param objSize size in bytes of objects being read from (handle).
  479. * @param objCount number of (objSize) objects to read from (handle).
  480. * @return number of objects read. PHYSFS_getLastError() can shed light on
  481. * the reason this might be < (objCount).
  482. */
  483. int PHYSFS_read(void *handle, void *buffer, int objSize, int objCount);
  484. /**
  485. * Write data to a PhysicsFS filehandle. The file must be opened for writing.
  486. *
  487. * @param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend().
  488. * @param buffer buffer to store read data into.
  489. * @param objSize size in bytes of objects being read from (handle).
  490. * @param objCount number of (objSize) objects to read from (handle).
  491. * @return number of objects read. PHYSFS_getLastError() can shed light on
  492. * the reason this might be < (objCount).
  493. */
  494. int PHYSFS_write(void *handle, void *buffer, int objSize, int objCount);
  495. /**
  496. * Determine if the end of file has been reached in a PhysicsFS filehandle.
  497. *
  498. * @param handle handle returned from PHYSFS_openRead().
  499. * @return nonzero if EOF, zero if not.
  500. */
  501. int PHYSFS_eof(void *handle);
  502. /**
  503. * Determine current position within a PhysicsFS filehandle.
  504. *
  505. * @param handle handle returned from PHYSFS_open*().
  506. * @return offset in bytes from start of file. -1 if error occurred.
  507. * Specifics of the error can be gleaned from PHYSFS_getLastError().
  508. */
  509. int PHYSFS_tell(void *handle);
  510. /**
  511. * Seek to a new position within a PhysicsFS filehandle. The next read or write
  512. * will occur at that place. Seeking past the beginning or end of the file is
  513. * not allowed.
  514. *
  515. * @param handle handle returned from PHYSFS_open*().
  516. * @param pos number of bytes from start of file to seek to.
  517. * @return nonzero on success, zero on error. Specifics of the error can be
  518. * gleaned from PHYSFS_getLastError().
  519. */
  520. int PHYSFS_seek(void *handle, int pos);
  521. /* Byte-order reading. !!! Need types (Int16, Int32, etc) for these...
  522. int PHYSFS_readLE16(void *handle, int *buffer);
  523. int PHYSFS_readLE32(void *handle, int *buffer);
  524. int PHYSFS_readBE16(void *handle, int *buffer);
  525. int PHYSFS_readBE32(void *handle, int *buffer);
  526. int PHYSFS_writeLE16(void *handle, int buffer);
  527. int PHYSFS_writeLE32(void *handle, int buffer);
  528. int PHYSFS_writeBE16(void *handle, int buffer);
  529. int PHYSFS_writeBE32(void *handle, int buffer);
  530. */
  531. #ifdef __cplusplus
  532. }
  533. #endif
  534. #endif /* !defined _INCLUDE_PHYSFS_H_ */
  535. /* end of physfs.h ... */