The SDL_image API allows you to pass in a FILE* and get an SDL_Surface*.
Currently, I’m designing a map archive.
One of the files is a tileset. It will be a PNG image (Great format with it’s lossless compression).
I’m reading all the bytes from the file and putting them into a buffer (a byte array).
How would I go about creating a FILE* out of a byte array?
I don’t care if I have to modify anything inside the FILE structure that’s meant to be private, that was my initial approach, but I was facing difficulties figuring out what a couple of the members of the struct are for. (I’m referring to the _iobuf struct)
Edit
You have to understand that I’m using zlib, meaning that when reading from the uncompressed files in the archive, I’m using the function unzReadCurrentFile.
I don’t know if there’s a way to get a FILE* directly while using zlib.
You can’t. It’s impossibru. A
FILE*is just that- a file. You can’t do anything about the fact that the SDL API uses C I/O and therefore is approximately as useful as a dead fish.