46
Jo Engine Wish List / Re: Reading binary files with pointers instead of returned char stream?
« on: October 11, 2017, 02:16:37 pm »
I made a new version (http://jo-engine.org/download/) with CD read-retry and a new function:
Now you can skip a part of a file and use jo_fs_read_next_bytes() after (just don't forget to shift the pointer : buffer + nbytes)
Example:
Code: [Select]
/** @brief Seek forward from current position of a file
* @param file Pointer to an allocated and valid jo_file struct
* @param nbytes number of bytes to skip
* @return true if succeed
*/
bool jo_fs_seek_forward(jo_file * const file, unsigned int nbytes);
Now you can skip a part of a file and use jo_fs_read_next_bytes() after (just don't forget to shift the pointer : buffer + nbytes)
Example:
Code: [Select]
jo_file file;
char *file_contents;
...
jo_fs_open(&file, "FILE.TXT");
jo_fs_seek_forward(&file, 4096); /* I assume that 4096 is the size of the part to skip in the file and to preserve in the buffer */
jo_fs_read_next_bytes(&file, file_contents + 4096, 42);
jo_fs_close(&file);