Thread: Create FILE* from char buffer (or perhaps another idea)

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    14

    Create FILE* from char buffer (or perhaps another idea)

    Hi all. I am a C beginner here. I've been using libpng to open png files.

    I hope to eventually have one file that has more than one png in it (compressed or not), call it the main file.

    Is it possible to say, read x amount of bytes from the main file, and then make another FILE* with its buffer pointing to the x amount of bytes I just read?

    Seems like an easier solution than my other idea, to see if I can figure out how to get libpng to read from a char buffer.

    Thanks

  2. #2
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    page 45 of the current libpng manual describes how to substitute your own IO functions for the standard FILE * functions. using those, you can implement functions that read from your char buffer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. writing to a char buffer as a FILE*
    By Opply in forum C++ Programming
    Replies: 17
    Last Post: 06-14-2012, 10:15 AM
  2. Char Buffer filtering
    By TGM76 in forum C Programming
    Replies: 3
    Last Post: 08-03-2010, 11:42 PM
  3. how to know if there is some char in the buffer..
    By transgalactic2 in forum C Programming
    Replies: 30
    Last Post: 01-30-2009, 03:27 PM
  4. Using a *char Buffer
    By Hankyaku in forum C++ Programming
    Replies: 2
    Last Post: 04-13-2003, 01:49 AM