Re: zlib OpennetCF question



Thanks a lot, I will look into it right now!

That was faaaaast!

"<ctacke/>" <ctacke[at]opennetcf[dot]com> schrieb im Newsbeitrag news:uuRJlMpBIHA.3456@xxxxxxxxxxxxxxxxxxxxxxx
The zlibCE source download from our site has been updated with these fixes.

http://www.opennetcf.com/zlibce


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com




"Sven Rutten" <svenrutten@xxxxxxxxxxx> wrote in message news:AB060359-AB05-4481-921D-779E77800FDE@xxxxxxxxxxxxxxxx
Thanks Chris, I've found it already, sorry.

But another question to that: I want to transmit the compressed byte.

Now my inputbyte has a length of about 38'000, but I cannot know the length of the compressed byte.
You are just declaring it in your code, there as 1024. So as I dont know it, I am using 10'000, as the always produced something between 5'000 and 7'000 compressed.

But my problem is, that I now have a compressed byte with the length of 10'000, and not the "real" size of it, meaning that the last 3-5'000 entries are just empty.

How can I know how long the bytearray really is and redim it?

The same for the uncompressed bytearray after uncompressing. I could submit the length of the original bytearray with it to dim it correctly, but yeah that's not really a good solution...

Thanks a lot

Sven

"<ctacke/>" <ctacke[at]opennetcf[dot]com> schrieb im Newsbeitrag news:eqd$5LiBIHA.748@xxxxxxxxxxxxxxxxxxxxxxx
Directly from the sample that comes with the zlibce download:

private static void TestCompressDecompress()
{
string source = "A quick brown fox jumped over lazy dogs";

byte[] src = Encoding.ASCII.GetBytes(source);
byte[] dst = new byte[1024];
ErrorCode ret = zlibCE.Compress(dst, src);

src = new byte[1024];
ret = zlibCE.Uncompress(src, dst);
}


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com


"Sven Rutten" <svenrutten@xxxxxxxxxxx> wrote in message news:E679C797-FCB0-45E7-B6BF-C7207BC290DD@xxxxxxxxxxxxxxxx
Hello

I'm using this code:

Dim inf As Stream = New System.IO.FileStream("\My Documents\test.txt", FileMode.Open)
Dim outf As Stream = File.Create("\My Documents\test.zip")
zlibCE.Deflate(inf, outf, 5)
inf.Close()
outf.Close()

That is working. But I have now no file, but a String which I want to compress. So I tried this:

Dim c As String = "TestingTestingTesting"
Dim tocompress() As Byte = System.Text.Encoding.Default.GetBytes(c)
Dim inf As Stream = New MemoryStream()
inf.Write(tocompress, 0, tocompress.Length)
Dim outf As Stream = File.Create("\My Documents\test.jj")
zlibCE.Deflate(inf, outf, 5)
inf.Close()
outf.Close()

So I convert to String to a Byte(), then I create a new MemoryStream, then I write the Byte to to MemoryStream.

After that I am Deflating normally...

But its not working?

What's Wrong?

Thanks

Sven




.