SDL_iostream.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /* WIKI CATEGORY: IOStream */
  19. /**
  20. * # CategoryIOStream
  21. *
  22. * SDL provides an abstract interface for reading and writing data streams. It
  23. * offers implementations for files, memory, etc, and the app can provideo
  24. * their own implementations, too.
  25. *
  26. * SDL_IOStream is not related to the standard C++ iostream class, other than
  27. * both are abstract interfaces to read/write data.
  28. */
  29. #ifndef SDL_iostream_h_
  30. #define SDL_iostream_h_
  31. #include <SDL3/SDL_stdinc.h>
  32. #include <SDL3/SDL_error.h>
  33. #include <SDL3/SDL_properties.h>
  34. #include <SDL3/SDL_begin_code.h>
  35. /* Set up for C function definitions, even when using C++ */
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. /**
  40. * SDL_IOStream status, set by a read or write operation.
  41. *
  42. * \since This enum is available since SDL 3.0.0.
  43. */
  44. typedef enum SDL_IOStatus
  45. {
  46. SDL_IO_STATUS_READY, /**< Everything is ready (no errors and not EOF). */
  47. SDL_IO_STATUS_ERROR, /**< Read or write I/O error */
  48. SDL_IO_STATUS_EOF, /**< End of file */
  49. SDL_IO_STATUS_NOT_READY, /**< Non blocking I/O, not ready */
  50. SDL_IO_STATUS_READONLY, /**< Tried to write a read-only buffer */
  51. SDL_IO_STATUS_WRITEONLY /**< Tried to read a write-only buffer */
  52. } SDL_IOStatus;
  53. /**
  54. * Possible `whence` values for SDL_IOStream seeking.
  55. *
  56. * These map to the same "whence" concept that `fseek` or `lseek` use in the
  57. * standard C runtime.
  58. *
  59. * \since This enum is available since SDL 3.0.0.
  60. */
  61. typedef enum SDL_IOWhence
  62. {
  63. SDL_IO_SEEK_SET, /**< Seek from the beginning of data */
  64. SDL_IO_SEEK_CUR, /**< Seek relative to current read point */
  65. SDL_IO_SEEK_END /**< Seek relative to the end of data */
  66. } SDL_IOWhence;
  67. /**
  68. * The function pointers that drive an SDL_IOStream.
  69. *
  70. * Applications can provide this struct to SDL_OpenIO() to create their own
  71. * implementation of SDL_IOStream. This is not necessarily required, as SDL
  72. * already offers several common types of I/O streams, via functions like
  73. * SDL_IOFromFile() and SDL_IOFromMem().
  74. *
  75. * This structure should be initialized using SDL_INIT_INTERFACE()
  76. *
  77. * \since This struct is available since SDL 3.0.0.
  78. *
  79. * \sa SDL_INIT_INTERFACE
  80. */
  81. typedef struct SDL_IOStreamInterface
  82. {
  83. /* The version of this interface */
  84. Uint32 version;
  85. /**
  86. * Return the number of bytes in this SDL_IOStream
  87. *
  88. * \return the total size of the data stream, or -1 on error.
  89. */
  90. Sint64 (SDLCALL *size)(void *userdata);
  91. /**
  92. * Seek to `offset` relative to `whence`, one of stdio's whence values:
  93. * SDL_IO_SEEK_SET, SDL_IO_SEEK_CUR, SDL_IO_SEEK_END
  94. *
  95. * \return the final offset in the data stream, or -1 on error.
  96. */
  97. Sint64 (SDLCALL *seek)(void *userdata, Sint64 offset, SDL_IOWhence whence);
  98. /**
  99. * Read up to `size` bytes from the data stream to the area pointed
  100. * at by `ptr`.
  101. *
  102. * On an incomplete read, you should set `*status` to a value from the
  103. * SDL_IOStatus enum. You do not have to explicitly set this on
  104. * a complete, successful read.
  105. *
  106. * \return the number of bytes read
  107. */
  108. size_t (SDLCALL *read)(void *userdata, void *ptr, size_t size, SDL_IOStatus *status);
  109. /**
  110. * Write exactly `size` bytes from the area pointed at by `ptr`
  111. * to data stream.
  112. *
  113. * On an incomplete write, you should set `*status` to a value from the
  114. * SDL_IOStatus enum. You do not have to explicitly set this on
  115. * a complete, successful write.
  116. *
  117. * \return the number of bytes written
  118. */
  119. size_t (SDLCALL *write)(void *userdata, const void *ptr, size_t size, SDL_IOStatus *status);
  120. /**
  121. * If the stream is buffering, make sure the data is written out.
  122. *
  123. * On failure, you should set `*status` to a value from the
  124. * SDL_IOStatus enum. You do not have to explicitly set this on
  125. * a successful flush.
  126. *
  127. * \return true if successful or false on write error when flushing data.
  128. */
  129. bool (SDLCALL *flush)(void *userdata, SDL_IOStatus *status);
  130. /**
  131. * Close and free any allocated resources.
  132. *
  133. * This does not guarantee file writes will sync to physical media; they
  134. * can be in the system's file cache, waiting to go to disk.
  135. *
  136. * The SDL_IOStream is still destroyed even if this fails, so clean up anything
  137. * even if flushing buffers, etc, returns an error.
  138. *
  139. * \return true if successful or false on write error when flushing data.
  140. */
  141. bool (SDLCALL *close)(void *userdata);
  142. } SDL_IOStreamInterface;
  143. /* Check the size of SDL_IOStreamInterface
  144. *
  145. * If this assert fails, either the compiler is padding to an unexpected size,
  146. * or the interface has been updated and this should be updated to match and
  147. * the code using this interface should be updated to handle the old version.
  148. */
  149. SDL_COMPILE_TIME_ASSERT(SDL_IOStreamInterface_SIZE,
  150. (sizeof(void *) == 4 && sizeof(SDL_IOStreamInterface) == 28) ||
  151. (sizeof(void *) == 8 && sizeof(SDL_IOStreamInterface) == 56));
  152. /**
  153. * The read/write operation structure.
  154. *
  155. * This operates as an opaque handle. There are several APIs to create various
  156. * types of I/O streams, or an app can supply an SDL_IOStreamInterface to
  157. * SDL_OpenIO() to provide their own stream implementation behind this
  158. * struct's abstract interface.
  159. *
  160. * \since This struct is available since SDL 3.0.0.
  161. */
  162. typedef struct SDL_IOStream SDL_IOStream;
  163. /**
  164. * \name IOFrom functions
  165. *
  166. * Functions to create SDL_IOStream structures from various data streams.
  167. */
  168. /* @{ */
  169. /**
  170. * Use this function to create a new SDL_IOStream structure for reading from
  171. * and/or writing to a named file.
  172. *
  173. * The `mode` string is treated roughly the same as in a call to the C
  174. * library's fopen(), even if SDL doesn't happen to use fopen() behind the
  175. * scenes.
  176. *
  177. * Available `mode` strings:
  178. *
  179. * - "r": Open a file for reading. The file must exist.
  180. * - "w": Create an empty file for writing. If a file with the same name
  181. * already exists its content is erased and the file is treated as a new
  182. * empty file.
  183. * - "a": Append to a file. Writing operations append data at the end of the
  184. * file. The file is created if it does not exist.
  185. * - "r+": Open a file for update both reading and writing. The file must
  186. * exist.
  187. * - "w+": Create an empty file for both reading and writing. If a file with
  188. * the same name already exists its content is erased and the file is
  189. * treated as a new empty file.
  190. * - "a+": Open a file for reading and appending. All writing operations are
  191. * performed at the end of the file, protecting the previous content to be
  192. * overwritten. You can reposition (fseek, rewind) the internal pointer to
  193. * anywhere in the file for reading, but writing operations will move it
  194. * back to the end of file. The file is created if it does not exist.
  195. *
  196. * **NOTE**: In order to open a file as a binary file, a "b" character has to
  197. * be included in the `mode` string. This additional "b" character can either
  198. * be appended at the end of the string (thus making the following compound
  199. * modes: "rb", "wb", "ab", "r+b", "w+b", "a+b") or be inserted between the
  200. * letter and the "+" sign for the mixed modes ("rb+", "wb+", "ab+").
  201. * Additional characters may follow the sequence, although they should have no
  202. * effect. For example, "t" is sometimes appended to make explicit the file is
  203. * a text file.
  204. *
  205. * This function supports Unicode filenames, but they must be encoded in UTF-8
  206. * format, regardless of the underlying operating system.
  207. *
  208. * In Android, SDL_IOFromFile() can be used to open content:// URIs. As a
  209. * fallback, SDL_IOFromFile() will transparently open a matching filename in
  210. * the app's `assets`.
  211. *
  212. * Closing the SDL_IOStream will close SDL's internal file handle.
  213. *
  214. * The following properties may be set at creation time by SDL:
  215. *
  216. * - `SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER`: a pointer, that can be cast
  217. * to a win32 `HANDLE`, that this SDL_IOStream is using to access the
  218. * filesystem. If the program isn't running on Windows, or SDL used some
  219. * other method to access the filesystem, this property will not be set.
  220. * - `SDL_PROP_IOSTREAM_STDIO_FILE_POINTER`: a pointer, that can be cast to a
  221. * stdio `FILE *`, that this SDL_IOStream is using to access the filesystem.
  222. * If SDL used some other method to access the filesystem, this property
  223. * will not be set. PLEASE NOTE that if SDL is using a different C runtime
  224. * than your app, trying to use this pointer will almost certainly result in
  225. * a crash! This is mostly a problem on Windows; make sure you build SDL and
  226. * your app with the same compiler and settings to avoid it.
  227. * - `SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER`: a file descriptor that this
  228. * SDL_IOStream is using to access the filesystem.
  229. * - `SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER`: a pointer, that can be cast
  230. * to an Android NDK `AAsset *`, that this SDL_IOStream is using to access
  231. * the filesystem. If SDL used some other method to access the filesystem,
  232. * this property will not be set.
  233. *
  234. * \param file a UTF-8 string representing the filename to open.
  235. * \param mode an ASCII string representing the mode to be used for opening
  236. * the file.
  237. * \returns a pointer to the SDL_IOStream structure that is created or NULL on
  238. * failure; call SDL_GetError() for more information.
  239. *
  240. * \since This function is available since SDL 3.0.0.
  241. *
  242. * \sa SDL_CloseIO
  243. * \sa SDL_FlushIO
  244. * \sa SDL_ReadIO
  245. * \sa SDL_SeekIO
  246. * \sa SDL_TellIO
  247. * \sa SDL_WriteIO
  248. */
  249. extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, const char *mode);
  250. #define SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER "SDL.iostream.windows.handle"
  251. #define SDL_PROP_IOSTREAM_STDIO_FILE_POINTER "SDL.iostream.stdio.file"
  252. #define SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER "SDL.iostream.file_descriptor"
  253. #define SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER "SDL.iostream.android.aasset"
  254. /**
  255. * Use this function to prepare a read-write memory buffer for use with
  256. * SDL_IOStream.
  257. *
  258. * This function sets up an SDL_IOStream struct based on a memory area of a
  259. * certain size, for both read and write access.
  260. *
  261. * This memory buffer is not copied by the SDL_IOStream; the pointer you
  262. * provide must remain valid until you close the stream. Closing the stream
  263. * will not free the original buffer.
  264. *
  265. * If you need to make sure the SDL_IOStream never writes to the memory
  266. * buffer, you should use SDL_IOFromConstMem() with a read-only buffer of
  267. * memory instead.
  268. *
  269. * \param mem a pointer to a buffer to feed an SDL_IOStream stream.
  270. * \param size the buffer size, in bytes.
  271. * \returns a pointer to a new SDL_IOStream structure or NULL on failure; call
  272. * SDL_GetError() for more information.
  273. *
  274. * \since This function is available since SDL 3.0.0.
  275. *
  276. * \sa SDL_IOFromConstMem
  277. * \sa SDL_CloseIO
  278. * \sa SDL_FlushIO
  279. * \sa SDL_ReadIO
  280. * \sa SDL_SeekIO
  281. * \sa SDL_TellIO
  282. * \sa SDL_WriteIO
  283. */
  284. extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromMem(void *mem, size_t size);
  285. /**
  286. * Use this function to prepare a read-only memory buffer for use with
  287. * SDL_IOStream.
  288. *
  289. * This function sets up an SDL_IOStream struct based on a memory area of a
  290. * certain size. It assumes the memory area is not writable.
  291. *
  292. * Attempting to write to this SDL_IOStream stream will report an error
  293. * without writing to the memory buffer.
  294. *
  295. * This memory buffer is not copied by the SDL_IOStream; the pointer you
  296. * provide must remain valid until you close the stream. Closing the stream
  297. * will not free the original buffer.
  298. *
  299. * If you need to write to a memory buffer, you should use SDL_IOFromMem()
  300. * with a writable buffer of memory instead.
  301. *
  302. * \param mem a pointer to a read-only buffer to feed an SDL_IOStream stream.
  303. * \param size the buffer size, in bytes.
  304. * \returns a pointer to a new SDL_IOStream structure or NULL on failure; call
  305. * SDL_GetError() for more information.
  306. *
  307. * \since This function is available since SDL 3.0.0.
  308. *
  309. * \sa SDL_IOFromMem
  310. * \sa SDL_CloseIO
  311. * \sa SDL_ReadIO
  312. * \sa SDL_SeekIO
  313. * \sa SDL_TellIO
  314. */
  315. extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromConstMem(const void *mem, size_t size);
  316. /**
  317. * Use this function to create an SDL_IOStream that is backed by dynamically
  318. * allocated memory.
  319. *
  320. * This supports the following properties to provide access to the memory and
  321. * control over allocations:
  322. *
  323. * - `SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER`: a pointer to the internal
  324. * memory of the stream. This can be set to NULL to transfer ownership of
  325. * the memory to the application, which should free the memory with
  326. * SDL_free(). If this is done, the next operation on the stream must be
  327. * SDL_CloseIO().
  328. * - `SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER`: memory will be allocated in
  329. * multiples of this size, defaulting to 1024.
  330. *
  331. * \returns a pointer to a new SDL_IOStream structure or NULL on failure; call
  332. * SDL_GetError() for more information.
  333. *
  334. * \since This function is available since SDL 3.0.0.
  335. *
  336. * \sa SDL_CloseIO
  337. * \sa SDL_ReadIO
  338. * \sa SDL_SeekIO
  339. * \sa SDL_TellIO
  340. * \sa SDL_WriteIO
  341. */
  342. extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromDynamicMem(void);
  343. #define SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER "SDL.iostream.dynamic.memory"
  344. #define SDL_PROP_IOSTREAM_DYNAMIC_CHUNKSIZE_NUMBER "SDL.iostream.dynamic.chunksize"
  345. /* @} *//* IOFrom functions */
  346. /**
  347. * Create a custom SDL_IOStream.
  348. *
  349. * Applications do not need to use this function unless they are providing
  350. * their own SDL_IOStream implementation. If you just need an SDL_IOStream to
  351. * read/write a common data source, you should use the built-in
  352. * implementations in SDL, like SDL_IOFromFile() or SDL_IOFromMem(), etc.
  353. *
  354. * This function makes a copy of `iface` and the caller does not need to keep
  355. * it around after this call.
  356. *
  357. * \param iface the interface that implements this SDL_IOStream, initialized
  358. * using SDL_INIT_INTERFACE().
  359. * \param userdata the pointer that will be passed to the interface functions.
  360. * \returns a pointer to the allocated memory on success or NULL on failure;
  361. * call SDL_GetError() for more information.
  362. *
  363. * \since This function is available since SDL 3.0.0.
  364. *
  365. * \sa SDL_CloseIO
  366. * \sa SDL_INIT_INTERFACE
  367. * \sa SDL_IOFromConstMem
  368. * \sa SDL_IOFromFile
  369. * \sa SDL_IOFromMem
  370. */
  371. extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterface *iface, void *userdata);
  372. /**
  373. * Close and free an allocated SDL_IOStream structure.
  374. *
  375. * SDL_CloseIO() closes and cleans up the SDL_IOStream stream. It releases any
  376. * resources used by the stream and frees the SDL_IOStream itself. This
  377. * returns true on success, or false if the stream failed to flush to its
  378. * output (e.g. to disk).
  379. *
  380. * Note that if this fails to flush the stream for any reason, this function
  381. * reports an error, but the SDL_IOStream is still invalid once this function
  382. * returns.
  383. *
  384. * This call flushes any buffered writes to the operating system, but there
  385. * are no guarantees that those writes have gone to physical media; they might
  386. * be in the OS's file cache, waiting to go to disk later. If it's absolutely
  387. * crucial that writes go to disk immediately, so they are definitely stored
  388. * even if the power fails before the file cache would have caught up, one
  389. * should call SDL_FlushIO() before closing. Note that flushing takes time and
  390. * makes the system and your app operate less efficiently, so do so sparingly.
  391. *
  392. * \param context SDL_IOStream structure to close.
  393. * \returns true on success or false on failure; call SDL_GetError() for more
  394. * information.
  395. *
  396. * \since This function is available since SDL 3.0.0.
  397. *
  398. * \sa SDL_OpenIO
  399. */
  400. extern SDL_DECLSPEC bool SDLCALL SDL_CloseIO(SDL_IOStream *context);
  401. /**
  402. * Get the properties associated with an SDL_IOStream.
  403. *
  404. * \param context a pointer to an SDL_IOStream structure.
  405. * \returns a valid property ID on success or 0 on failure; call
  406. * SDL_GetError() for more information.
  407. *
  408. * \since This function is available since SDL 3.0.0.
  409. */
  410. extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *context);
  411. /**
  412. * Query the stream status of an SDL_IOStream.
  413. *
  414. * This information can be useful to decide if a short read or write was due
  415. * to an error, an EOF, or a non-blocking operation that isn't yet ready to
  416. * complete.
  417. *
  418. * An SDL_IOStream's status is only expected to change after a SDL_ReadIO or
  419. * SDL_WriteIO call; don't expect it to change if you just call this query
  420. * function in a tight loop.
  421. *
  422. * \param context the SDL_IOStream to query.
  423. * \returns an SDL_IOStatus enum with the current state.
  424. *
  425. * \threadsafety This function should not be called at the same time that
  426. * another thread is operating on the same SDL_IOStream.
  427. *
  428. * \since This function is available since SDL 3.0.0.
  429. */
  430. extern SDL_DECLSPEC SDL_IOStatus SDLCALL SDL_GetIOStatus(SDL_IOStream *context);
  431. /**
  432. * Use this function to get the size of the data stream in an SDL_IOStream.
  433. *
  434. * \param context the SDL_IOStream to get the size of the data stream from.
  435. * \returns the size of the data stream in the SDL_IOStream on success or a
  436. * negative error code on failure; call SDL_GetError() for more
  437. * information.
  438. *
  439. * \since This function is available since SDL 3.0.0.
  440. */
  441. extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context);
  442. /**
  443. * Seek within an SDL_IOStream data stream.
  444. *
  445. * This function seeks to byte `offset`, relative to `whence`.
  446. *
  447. * `whence` may be any of the following values:
  448. *
  449. * - `SDL_IO_SEEK_SET`: seek from the beginning of data
  450. * - `SDL_IO_SEEK_CUR`: seek relative to current read point
  451. * - `SDL_IO_SEEK_END`: seek relative to the end of data
  452. *
  453. * If this stream can not seek, it will return -1.
  454. *
  455. * \param context a pointer to an SDL_IOStream structure.
  456. * \param offset an offset in bytes, relative to `whence` location; can be
  457. * negative.
  458. * \param whence any of `SDL_IO_SEEK_SET`, `SDL_IO_SEEK_CUR`,
  459. * `SDL_IO_SEEK_END`.
  460. * \returns the final offset in the data stream after the seek or -1 on
  461. * failure; call SDL_GetError() for more information.
  462. *
  463. * \since This function is available since SDL 3.0.0.
  464. *
  465. * \sa SDL_TellIO
  466. */
  467. extern SDL_DECLSPEC Sint64 SDLCALL SDL_SeekIO(SDL_IOStream *context, Sint64 offset, SDL_IOWhence whence);
  468. /**
  469. * Determine the current read/write offset in an SDL_IOStream data stream.
  470. *
  471. * SDL_TellIO is actually a wrapper function that calls the SDL_IOStream's
  472. * `seek` method, with an offset of 0 bytes from `SDL_IO_SEEK_CUR`, to
  473. * simplify application development.
  474. *
  475. * \param context an SDL_IOStream data stream object from which to get the
  476. * current offset.
  477. * \returns the current offset in the stream, or -1 if the information can not
  478. * be determined.
  479. *
  480. * \since This function is available since SDL 3.0.0.
  481. *
  482. * \sa SDL_SeekIO
  483. */
  484. extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context);
  485. /**
  486. * Read from a data source.
  487. *
  488. * This function reads up `size` bytes from the data source to the area
  489. * pointed at by `ptr`. This function may read less bytes than requested. It
  490. * will return zero when the data stream is completely read, and
  491. * SDL_GetIOStatus() will return SDL_IO_STATUS_EOF, or on error, and
  492. * SDL_GetIOStatus() will return SDL_IO_STATUS_ERROR.
  493. *
  494. * \param context a pointer to an SDL_IOStream structure.
  495. * \param ptr a pointer to a buffer to read data into.
  496. * \param size the number of bytes to read from the data source.
  497. * \returns the number of bytes read, or 0 on end of file or other failure;
  498. * call SDL_GetError() for more information.
  499. *
  500. * \since This function is available since SDL 3.0.0.
  501. *
  502. * \sa SDL_WriteIO
  503. * \sa SDL_GetIOStatus
  504. */
  505. extern SDL_DECLSPEC size_t SDLCALL SDL_ReadIO(SDL_IOStream *context, void *ptr, size_t size);
  506. /**
  507. * Write to an SDL_IOStream data stream.
  508. *
  509. * This function writes exactly `size` bytes from the area pointed at by `ptr`
  510. * to the stream. If this fails for any reason, it'll return less than `size`
  511. * to demonstrate how far the write progressed. On success, it returns `size`.
  512. *
  513. * On error, this function still attempts to write as much as possible, so it
  514. * might return a positive value less than the requested write size.
  515. *
  516. * The caller can use SDL_GetIOStatus() to determine if the problem is
  517. * recoverable, such as a non-blocking write that can simply be retried later,
  518. * or a fatal error.
  519. *
  520. * \param context a pointer to an SDL_IOStream structure.
  521. * \param ptr a pointer to a buffer containing data to write.
  522. * \param size the number of bytes to write.
  523. * \returns the number of bytes written, which will be less than `size` on
  524. * failure; call SDL_GetError() for more information.
  525. *
  526. * \since This function is available since SDL 3.0.0.
  527. *
  528. * \sa SDL_IOprintf
  529. * \sa SDL_ReadIO
  530. * \sa SDL_SeekIO
  531. * \sa SDL_FlushIO
  532. * \sa SDL_GetIOStatus
  533. */
  534. extern SDL_DECLSPEC size_t SDLCALL SDL_WriteIO(SDL_IOStream *context, const void *ptr, size_t size);
  535. /**
  536. * Print to an SDL_IOStream data stream.
  537. *
  538. * This function does formatted printing to the stream.
  539. *
  540. * \param context a pointer to an SDL_IOStream structure.
  541. * \param fmt a printf() style format string.
  542. * \param ... additional parameters matching % tokens in the `fmt` string, if
  543. * any.
  544. * \returns the number of bytes written or 0 on failure; call SDL_GetError()
  545. * for more information.
  546. *
  547. * \since This function is available since SDL 3.0.0.
  548. *
  549. * \sa SDL_IOvprintf
  550. * \sa SDL_WriteIO
  551. */
  552. extern SDL_DECLSPEC size_t SDLCALL SDL_IOprintf(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
  553. /**
  554. * Print to an SDL_IOStream data stream.
  555. *
  556. * This function does formatted printing to the stream.
  557. *
  558. * \param context a pointer to an SDL_IOStream structure.
  559. * \param fmt a printf() style format string.
  560. * \param ap a variable argument list.
  561. * \returns the number of bytes written or 0 on failure; call SDL_GetError()
  562. * for more information.
  563. *
  564. * \since This function is available since SDL 3.0.0.
  565. *
  566. * \sa SDL_IOprintf
  567. * \sa SDL_WriteIO
  568. */
  569. extern SDL_DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2);
  570. /**
  571. * Flush any buffered data in the stream.
  572. *
  573. * This function makes sure that any buffered data is written to the stream.
  574. * Normally this isn't necessary but if the stream is a pipe or socket it
  575. * guarantees that any pending data is sent.
  576. *
  577. * \param context SDL_IOStream structure to flush.
  578. * \returns true on success or false on failure; call SDL_GetError() for more
  579. * information.
  580. *
  581. * \since This function is available since SDL 3.0.0.
  582. *
  583. * \sa SDL_OpenIO
  584. * \sa SDL_WriteIO
  585. */
  586. extern SDL_DECLSPEC bool SDLCALL SDL_FlushIO(SDL_IOStream *context);
  587. /**
  588. * Load all the data from an SDL data stream.
  589. *
  590. * The data is allocated with a zero byte at the end (null terminated) for
  591. * convenience. This extra byte is not included in the value reported via
  592. * `datasize`.
  593. *
  594. * The data should be freed with SDL_free().
  595. *
  596. * \param src the SDL_IOStream to read all available data from.
  597. * \param datasize a pointer filled in with the number of bytes read, may be
  598. * NULL.
  599. * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even
  600. * in the case of an error.
  601. * \returns the data or NULL on failure; call SDL_GetError() for more
  602. * information.
  603. *
  604. * \since This function is available since SDL 3.0.0.
  605. *
  606. * \sa SDL_LoadFile
  607. */
  608. extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, bool closeio);
  609. /**
  610. * Load all the data from a file path.
  611. *
  612. * The data is allocated with a zero byte at the end (null terminated) for
  613. * convenience. This extra byte is not included in the value reported via
  614. * `datasize`.
  615. *
  616. * The data should be freed with SDL_free().
  617. *
  618. * \param file the path to read all available data from.
  619. * \param datasize if not NULL, will store the number of bytes read.
  620. * \returns the data or NULL on failure; call SDL_GetError() for more
  621. * information.
  622. *
  623. * \since This function is available since SDL 3.0.0.
  624. *
  625. * \sa SDL_LoadFile_IO
  626. */
  627. extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
  628. /**
  629. * \name Read endian functions
  630. *
  631. * Read an item of the specified endianness and return in native format.
  632. */
  633. /* @{ */
  634. /**
  635. * Use this function to read a byte from an SDL_IOStream.
  636. *
  637. * \param src the SDL_IOStream to read from.
  638. * \param value a pointer filled in with the data read.
  639. * \returns true on success or false on failure; call SDL_GetError() for more
  640. * information.
  641. *
  642. * \since This function is available since SDL 3.0.0.
  643. */
  644. extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value);
  645. /**
  646. * Use this function to read a signed byte from an SDL_IOStream.
  647. *
  648. * \param src the SDL_IOStream to read from.
  649. * \param value a pointer filled in with the data read.
  650. * \returns true on success or false on failure; call SDL_GetError() for more
  651. * information.
  652. *
  653. * \since This function is available since SDL 3.0.0.
  654. */
  655. extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value);
  656. /**
  657. * Use this function to read 16 bits of little-endian data from an
  658. * SDL_IOStream and return in native format.
  659. *
  660. * SDL byteswaps the data only if necessary, so the data returned will be in
  661. * the native byte order.
  662. *
  663. * \param src the stream from which to read data.
  664. * \param value a pointer filled in with the data read.
  665. * \returns true on successful write or false on failure; call SDL_GetError()
  666. * for more information.
  667. *
  668. * \since This function is available since SDL 3.0.0.
  669. */
  670. extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value);
  671. /**
  672. * Use this function to read 16 bits of little-endian data from an
  673. * SDL_IOStream and return in native format.
  674. *
  675. * SDL byteswaps the data only if necessary, so the data returned will be in
  676. * the native byte order.
  677. *
  678. * \param src the stream from which to read data.
  679. * \param value a pointer filled in with the data read.
  680. * \returns true on successful write or false on failure; call SDL_GetError()
  681. * for more information.
  682. *
  683. * \since This function is available since SDL 3.0.0.
  684. */
  685. extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value);
  686. /**
  687. * Use this function to read 16 bits of big-endian data from an SDL_IOStream
  688. * and return in native format.
  689. *
  690. * SDL byteswaps the data only if necessary, so the data returned will be in
  691. * the native byte order.
  692. *
  693. * \param src the stream from which to read data.
  694. * \param value a pointer filled in with the data read.
  695. * \returns true on successful write or false on failure; call SDL_GetError()
  696. * for more information.
  697. *
  698. * \since This function is available since SDL 3.0.0.
  699. */
  700. extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value);
  701. /**
  702. * Use this function to read 16 bits of big-endian data from an SDL_IOStream
  703. * and return in native format.
  704. *
  705. * SDL byteswaps the data only if necessary, so the data returned will be in
  706. * the native byte order.
  707. *
  708. * \param src the stream from which to read data.
  709. * \param value a pointer filled in with the data read.
  710. * \returns true on successful write or false on failure; call SDL_GetError()
  711. * for more information.
  712. *
  713. * \since This function is available since SDL 3.0.0.
  714. */
  715. extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value);
  716. /**
  717. * Use this function to read 32 bits of little-endian data from an
  718. * SDL_IOStream and return in native format.
  719. *
  720. * SDL byteswaps the data only if necessary, so the data returned will be in
  721. * the native byte order.
  722. *
  723. * \param src the stream from which to read data.
  724. * \param value a pointer filled in with the data read.
  725. * \returns true on successful write or false on failure; call SDL_GetError()
  726. * for more information.
  727. *
  728. * \since This function is available since SDL 3.0.0.
  729. */
  730. extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value);
  731. /**
  732. * Use this function to read 32 bits of little-endian data from an
  733. * SDL_IOStream and return in native format.
  734. *
  735. * SDL byteswaps the data only if necessary, so the data returned will be in
  736. * the native byte order.
  737. *
  738. * \param src the stream from which to read data.
  739. * \param value a pointer filled in with the data read.
  740. * \returns true on successful write or false on failure; call SDL_GetError()
  741. * for more information.
  742. *
  743. * \since This function is available since SDL 3.0.0.
  744. */
  745. extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value);
  746. /**
  747. * Use this function to read 32 bits of big-endian data from an SDL_IOStream
  748. * and return in native format.
  749. *
  750. * SDL byteswaps the data only if necessary, so the data returned will be in
  751. * the native byte order.
  752. *
  753. * \param src the stream from which to read data.
  754. * \param value a pointer filled in with the data read.
  755. * \returns true on successful write or false on failure; call SDL_GetError()
  756. * for more information.
  757. *
  758. * \since This function is available since SDL 3.0.0.
  759. */
  760. extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value);
  761. /**
  762. * Use this function to read 32 bits of big-endian data from an SDL_IOStream
  763. * and return in native format.
  764. *
  765. * SDL byteswaps the data only if necessary, so the data returned will be in
  766. * the native byte order.
  767. *
  768. * \param src the stream from which to read data.
  769. * \param value a pointer filled in with the data read.
  770. * \returns true on successful write or false on failure; call SDL_GetError()
  771. * for more information.
  772. *
  773. * \since This function is available since SDL 3.0.0.
  774. */
  775. extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value);
  776. /**
  777. * Use this function to read 64 bits of little-endian data from an
  778. * SDL_IOStream and return in native format.
  779. *
  780. * SDL byteswaps the data only if necessary, so the data returned will be in
  781. * the native byte order.
  782. *
  783. * \param src the stream from which to read data.
  784. * \param value a pointer filled in with the data read.
  785. * \returns true on successful write or false on failure; call SDL_GetError()
  786. * for more information.
  787. *
  788. * \since This function is available since SDL 3.0.0.
  789. */
  790. extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value);
  791. /**
  792. * Use this function to read 64 bits of little-endian data from an
  793. * SDL_IOStream and return in native format.
  794. *
  795. * SDL byteswaps the data only if necessary, so the data returned will be in
  796. * the native byte order.
  797. *
  798. * \param src the stream from which to read data.
  799. * \param value a pointer filled in with the data read.
  800. * \returns true on successful write or false on failure; call SDL_GetError()
  801. * for more information.
  802. *
  803. * \since This function is available since SDL 3.0.0.
  804. */
  805. extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value);
  806. /**
  807. * Use this function to read 64 bits of big-endian data from an SDL_IOStream
  808. * and return in native format.
  809. *
  810. * SDL byteswaps the data only if necessary, so the data returned will be in
  811. * the native byte order.
  812. *
  813. * \param src the stream from which to read data.
  814. * \param value a pointer filled in with the data read.
  815. * \returns true on successful write or false on failure; call SDL_GetError()
  816. * for more information.
  817. *
  818. * \since This function is available since SDL 3.0.0.
  819. */
  820. extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value);
  821. /**
  822. * Use this function to read 64 bits of big-endian data from an SDL_IOStream
  823. * and return in native format.
  824. *
  825. * SDL byteswaps the data only if necessary, so the data returned will be in
  826. * the native byte order.
  827. *
  828. * \param src the stream from which to read data.
  829. * \param value a pointer filled in with the data read.
  830. * \returns true on successful write or false on failure; call SDL_GetError()
  831. * for more information.
  832. *
  833. * \since This function is available since SDL 3.0.0.
  834. */
  835. extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value);
  836. /* @} *//* Read endian functions */
  837. /**
  838. * \name Write endian functions
  839. *
  840. * Write an item of native format to the specified endianness.
  841. */
  842. /* @{ */
  843. /**
  844. * Use this function to write a byte to an SDL_IOStream.
  845. *
  846. * \param dst the SDL_IOStream to write to.
  847. * \param value the byte value to write.
  848. * \returns true on successful write or false on failure; call SDL_GetError()
  849. * for more information.
  850. *
  851. * \since This function is available since SDL 3.0.0.
  852. */
  853. extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value);
  854. /**
  855. * Use this function to write a signed byte to an SDL_IOStream.
  856. *
  857. * \param dst the SDL_IOStream to write to.
  858. * \param value the byte value to write.
  859. * \returns true on successful write or false on failure; call SDL_GetError()
  860. * for more information.
  861. *
  862. * \since This function is available since SDL 3.0.0.
  863. */
  864. extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value);
  865. /**
  866. * Use this function to write 16 bits in native format to an SDL_IOStream as
  867. * little-endian data.
  868. *
  869. * SDL byteswaps the data only if necessary, so the application always
  870. * specifies native format, and the data written will be in little-endian
  871. * format.
  872. *
  873. * \param dst the stream to which data will be written.
  874. * \param value the data to be written, in native format.
  875. * \returns true on successful write or false on failure; call SDL_GetError()
  876. * for more information.
  877. *
  878. * \since This function is available since SDL 3.0.0.
  879. */
  880. extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value);
  881. /**
  882. * Use this function to write 16 bits in native format to an SDL_IOStream as
  883. * little-endian data.
  884. *
  885. * SDL byteswaps the data only if necessary, so the application always
  886. * specifies native format, and the data written will be in little-endian
  887. * format.
  888. *
  889. * \param dst the stream to which data will be written.
  890. * \param value the data to be written, in native format.
  891. * \returns true on successful write or false on failure; call SDL_GetError()
  892. * for more information.
  893. *
  894. * \since This function is available since SDL 3.0.0.
  895. */
  896. extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value);
  897. /**
  898. * Use this function to write 16 bits in native format to an SDL_IOStream as
  899. * big-endian data.
  900. *
  901. * SDL byteswaps the data only if necessary, so the application always
  902. * specifies native format, and the data written will be in big-endian format.
  903. *
  904. * \param dst the stream to which data will be written.
  905. * \param value the data to be written, in native format.
  906. * \returns true on successful write or false on failure; call SDL_GetError()
  907. * for more information.
  908. *
  909. * \since This function is available since SDL 3.0.0.
  910. */
  911. extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value);
  912. /**
  913. * Use this function to write 16 bits in native format to an SDL_IOStream as
  914. * big-endian data.
  915. *
  916. * SDL byteswaps the data only if necessary, so the application always
  917. * specifies native format, and the data written will be in big-endian format.
  918. *
  919. * \param dst the stream to which data will be written.
  920. * \param value the data to be written, in native format.
  921. * \returns true on successful write or false on failure; call SDL_GetError()
  922. * for more information.
  923. *
  924. * \since This function is available since SDL 3.0.0.
  925. */
  926. extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value);
  927. /**
  928. * Use this function to write 32 bits in native format to an SDL_IOStream as
  929. * little-endian data.
  930. *
  931. * SDL byteswaps the data only if necessary, so the application always
  932. * specifies native format, and the data written will be in little-endian
  933. * format.
  934. *
  935. * \param dst the stream to which data will be written.
  936. * \param value the data to be written, in native format.
  937. * \returns true on successful write or false on failure; call SDL_GetError()
  938. * for more information.
  939. *
  940. * \since This function is available since SDL 3.0.0.
  941. */
  942. extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value);
  943. /**
  944. * Use this function to write 32 bits in native format to an SDL_IOStream as
  945. * little-endian data.
  946. *
  947. * SDL byteswaps the data only if necessary, so the application always
  948. * specifies native format, and the data written will be in little-endian
  949. * format.
  950. *
  951. * \param dst the stream to which data will be written.
  952. * \param value the data to be written, in native format.
  953. * \returns true on successful write or false on failure; call SDL_GetError()
  954. * for more information.
  955. *
  956. * \since This function is available since SDL 3.0.0.
  957. */
  958. extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value);
  959. /**
  960. * Use this function to write 32 bits in native format to an SDL_IOStream as
  961. * big-endian data.
  962. *
  963. * SDL byteswaps the data only if necessary, so the application always
  964. * specifies native format, and the data written will be in big-endian format.
  965. *
  966. * \param dst the stream to which data will be written.
  967. * \param value the data to be written, in native format.
  968. * \returns true on successful write or false on failure; call SDL_GetError()
  969. * for more information.
  970. *
  971. * \since This function is available since SDL 3.0.0.
  972. */
  973. extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value);
  974. /**
  975. * Use this function to write 32 bits in native format to an SDL_IOStream as
  976. * big-endian data.
  977. *
  978. * SDL byteswaps the data only if necessary, so the application always
  979. * specifies native format, and the data written will be in big-endian format.
  980. *
  981. * \param dst the stream to which data will be written.
  982. * \param value the data to be written, in native format.
  983. * \returns true on successful write or false on failure; call SDL_GetError()
  984. * for more information.
  985. *
  986. * \since This function is available since SDL 3.0.0.
  987. */
  988. extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value);
  989. /**
  990. * Use this function to write 64 bits in native format to an SDL_IOStream as
  991. * little-endian data.
  992. *
  993. * SDL byteswaps the data only if necessary, so the application always
  994. * specifies native format, and the data written will be in little-endian
  995. * format.
  996. *
  997. * \param dst the stream to which data will be written.
  998. * \param value the data to be written, in native format.
  999. * \returns true on successful write or false on failure; call SDL_GetError()
  1000. * for more information.
  1001. *
  1002. * \since This function is available since SDL 3.0.0.
  1003. */
  1004. extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value);
  1005. /**
  1006. * Use this function to write 64 bits in native format to an SDL_IOStream as
  1007. * little-endian data.
  1008. *
  1009. * SDL byteswaps the data only if necessary, so the application always
  1010. * specifies native format, and the data written will be in little-endian
  1011. * format.
  1012. *
  1013. * \param dst the stream to which data will be written.
  1014. * \param value the data to be written, in native format.
  1015. * \returns true on successful write or false on failure; call SDL_GetError()
  1016. * for more information.
  1017. *
  1018. * \since This function is available since SDL 3.0.0.
  1019. */
  1020. extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value);
  1021. /**
  1022. * Use this function to write 64 bits in native format to an SDL_IOStream as
  1023. * big-endian data.
  1024. *
  1025. * SDL byteswaps the data only if necessary, so the application always
  1026. * specifies native format, and the data written will be in big-endian format.
  1027. *
  1028. * \param dst the stream to which data will be written.
  1029. * \param value the data to be written, in native format.
  1030. * \returns true on successful write or false on failure; call SDL_GetError()
  1031. * for more information.
  1032. *
  1033. * \since This function is available since SDL 3.0.0.
  1034. */
  1035. extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value);
  1036. /**
  1037. * Use this function to write 64 bits in native format to an SDL_IOStream as
  1038. * big-endian data.
  1039. *
  1040. * SDL byteswaps the data only if necessary, so the application always
  1041. * specifies native format, and the data written will be in big-endian format.
  1042. *
  1043. * \param dst the stream to which data will be written.
  1044. * \param value the data to be written, in native format.
  1045. * \returns true on successful write or false on failure; call SDL_GetError()
  1046. * for more information.
  1047. *
  1048. * \since This function is available since SDL 3.0.0.
  1049. */
  1050. extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value);
  1051. /* @} *//* Write endian functions */
  1052. /* Ends C function definitions when using C++ */
  1053. #ifdef __cplusplus
  1054. }
  1055. #endif
  1056. #include <SDL3/SDL_close_code.h>
  1057. #endif /* SDL_iostream_h_ */