Thread: GZIP Data

  1. #1
    Registered User
    Join Date
    Jun 2006

    GZIP Data

    Does c# interpret gzip data differently than vb6? I rewrote one of my vb6 programs in c# and i send a request, and receive data back. Then i split the data into headers and body. I then try to decompress the gzip body and it always fails with a "magic number is wrong" error. I tried my decompression on data generated from my vb6 project and it works fine, so it must have something to do with c# interprets it, or how i put it into the stream i decompress from. I found that if i put  (not <) between the 2 box characters at the beggining of my gzip data, it fails with a crc error instead, probably because i added data. Here's is how i put the string of data i received into the stream for decompression.

    public static byte[] StrToByteArray(string str)
                System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
                return encoding.GetBytes(str);
    byte[] strHTMLb = StrToByteArray(strParts[1]);
    MemoryStream memstream = new MemoryStream(strHTMLb);
    Thanks for any ideas or help

  2. #2
    Join Date
    Feb 2002
    None of the code you've given us will help us help you. Where does the data come from? Are you sure the data isn't corrupt? How do you split the file into a header section and a data section? Why are you even spliting the file, since you could use the GZipStream class (which, ironically, is the same advice you got from VBForums).
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. xor linked list
    By adramalech in forum C Programming
    Replies: 23
    Last Post: 10-14-2008, 10:13 AM
  2. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  3. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  4. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 10:28 PM
  5. Replies: 1
    Last Post: 07-31-2002, 11:35 AM