Copying contents of gzip file in character buffer

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

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.

Advertisements

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...

Advertisements

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.

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.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!