Thread: Extract data from buffer

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    8

    Extract data from buffer

    Newbie question:

    I have a buffer of data generated by decompressing a zlib compressed FILE, that includes a file header, some array data and a bitmap image. Now that I have the buffer in memory, how can I access each of the individual elements.

    The header, for example, makes up the first 8 bytes of the buffer but I can't figure out how to extract these into my header variable (a struct). Any suggestions?
    Last edited by freevryheid; 01-13-2009 at 01:17 PM. Reason: That should be buffer :)

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    memcpy, maybe?

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    8
    wow - that was easy. thx.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Lame null append cause buffer to crash
    By cmoo in forum C Programming
    Replies: 8
    Last Post: 12-29-2008, 03:27 AM
  2. Does realloc save the previous buffer data?
    By Niara in forum C Programming
    Replies: 6
    Last Post: 07-23-2008, 04:40 AM
  3. DirectSound - multiple sounds
    By Magos in forum Game Programming
    Replies: 9
    Last Post: 03-03-2004, 04:33 PM
  4. Need EOF help trying to extract data from .dat file
    By CodeNewB in forum C Programming
    Replies: 3
    Last Post: 09-13-2002, 07:36 PM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM