std.zlib.Compress / UnCompress are not working

Walter Bright newshound at digitalmars.com
Mon May 29 12:27:01 PDT 2006


Try this:

void arrayPrint(ubyte[] array)
{
     //printf("array %p,%d\n", (void*)array, array.length);
     for (int i = 0; i < array.length; i++)
     {
         printf("%02x ", array[i]);
         if (((i + 1) & 15) == 0)
             printf("\n");
     }
     printf("\n\n");
}

void testzlib()
{
     ubyte[] src = cast(ubyte[])
"the quick brown fox jumps over the lazy dog\r
the quick brown fox jumps over the lazy dog\r
";
     ubyte[] dst;

     arrayPrint(src);
     dst = cast(ubyte[])std.zlib.compress(cast(void[])src);
     arrayPrint(dst);
     src = cast(ubyte[])std.zlib.uncompress(cast(void[])dst);
     arrayPrint(src);
}



More information about the Digitalmars-d-bugs mailing list