Copying contents of gzip file in character buffer

Discussion in 'C Programming' started by lokaresa@gmail.com, Mar 13, 2008.

  1. Guest

    Dear,
    I have one .gz(gzip) file. I want to coping all contents
    of .gz file into character buffer.
    I tried, but at end of buffer i am getting '0xcd' extra one byte in
    buffer.Please tell, how I wrote C language program that will give the
    extract content of file in buffer.
    , Mar 13, 2008
    #1
    1. Advertising

  2. liveshell Guest

    Re: Copying contents of gzip file in character buffer

    On Mar 13, 11:09 am, wrote:
    > Dear,
    >          I  have one .gz(gzip) file. I want to coping all contents
    > of .gz file into  character buffer.
    > I tried, but at end of buffer i am getting  '0xcd' extra one byte in
    > buffer.Please tell, how I wrote C language program that will give the
    > extract content of file in buffer.


    Can you please specify which function are you using to open and read
    gzip file??? Try to open and read using C lowelevel file handling
    functions...
    liveshell, Mar 13, 2008
    #2
    1. Advertising

  3. santosh Guest

    wrote:

    > Dear,
    > I have one .gz(gzip) file. I want to coping all contents
    > of .gz file into character buffer.
    > I tried, but at end of buffer i am getting '0xcd' extra one byte in
    > buffer.Please tell, how I wrote C language program that will give the
    > extract content of file in buffer.


    Please post the code for your attempt.
    santosh, Mar 13, 2008
    #3
  4. On Wed, 12 Mar 2008 23:09:53 -0700 (PDT), wrote:

    > Dear,
    > I have one .gz(gzip) file. I want to coping all contents
    > of .gz file into character buffer.
    > I tried, but at end of buffer i am getting '0xcd' extra one byte in
    > buffer.Please tell, how I wrote C language program that will give the
    > extract content of file in buffer.


    Are you by any chance working on (MS) Windows, in debug mode?
    And (if so) how did you determine the length of the data you read?

    The Windows debug runtime fills malloc'ed space with 0xCD
    <caveat> as a feature, this isn't required by the standard </>
    so if you read actually N bytes into a buffer but try to use N+1,
    you'll get an 'extra' byte of 0xCD.

    - formerly david.thompson1 || achar(64) || worldnet.att.net
    David Thompson, Mar 24, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roy Hills

    Copying struct and unsigned char buffer

    Roy Hills, Oct 27, 2003, in forum: C Programming
    Replies:
    5
    Views:
    1,954
    Peter Shaggy Haywood
    Oct 31, 2003
  2. Replies:
    3
    Views:
    378
    Fredrik Lundh
    Dec 13, 2004
  3. flebber
    Replies:
    9
    Views:
    505
    John Machin
    Jun 10, 2007
  4. Navaneeth
    Replies:
    29
    Views:
    905
    Jorgen Grahn
    Aug 28, 2010
  5. Kamarulnizam Rahim
    Replies:
    4
    Views:
    203
    Robert Klemme
    Jan 28, 2011
Loading...

Share This Page