Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread Dmitry Olshansky
On 25-Sep-12 00:10, TJB wrote: Hello, I am trying to save some data to compressed binary files. I have my data in a struct, which I can write to a binary file just fine: align(1) struct TradesBin { Just a note: recently compiler changed so this align(1) have no effect on the fields

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread Justin Whear
On Tue, 25 Sep 2012 03:25:37 +0200, TJB wrote: Since you're already set up with the Stream interface, try creating a MemoryStream instead of a BufferedFile. Write to the stream just as you are now, then use the .data() property (on MemoryStream's superclass, TArrayStream) to get an array of

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread TJB
On Tuesday, 25 September 2012 at 18:08:44 UTC, Justin Whear wrote: I wrote up a quick example program and pasted it here: http://dpaste.dzfl.pl/f1699d07 Hope that helps you out. Justin, Thanks so much! Very helpful!!! TJB

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread Justin Whear
On Tue, 25 Sep 2012 18:08:44 +, Justin Whear wrote: On Tue, 25 Sep 2012 03:25:37 +0200, TJB wrote: Since you're already set up with the Stream interface, try creating a MemoryStream instead of a BufferedFile. Write to the stream just as you are now, then use the .data() property (on

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-25 Thread TJB
On Tuesday, 25 September 2012 at 18:08:44 UTC, Justin Whear wrote: I wrote up a quick example program and pasted it here: http://dpaste.dzfl.pl/f1699d07 Hope that helps you out. OK, I think I am working this out. Let's say I want to write the data to a gzipped file that will be

How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-24 Thread TJB
Hello, I am trying to save some data to compressed binary files. I have my data in a struct, which I can write to a binary file just fine: align(1) struct TradesBin { int ttim; int prc; int siz; short g127; short corr; char[2] cond; char ex; } auto fout = new

Re: How do I use std.zlib to write a struct of data to a binary file with compression?

2012-09-24 Thread TJB
Since you're already set up with the Stream interface, try creating a MemoryStream instead of a BufferedFile. Write to the stream just as you are now, then use the .data() property (on MemoryStream's superclass, TArrayStream) to get an array of raw bytes. You can feed this array into the