Are there any string "Sink" classes that use a char* instead of std::string?
I don't want to have to recopy the memory into my buffer class after I read
it in. If I use a char* I can assign that memory to my buffer class, but
std::string is more restrictive.

Thanks
-Sara

-----Original Message-----
From: Wei Dai [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 26, 2005 10:30 AM
To: [email protected]
Subject: Re: Using FileSource and ArraySink with Gunzip

Guess a size for the buffer, then after the decompression finishes, you can 
call ArraySink::TotalPutLength() to find out whether the buffer was large 
enough. Repeat the decompression with a larger buffer if it wasn't.

Another option is to use StringSink instead of ArraySink. But that way you 
run the risk of using up all of your memory (for example if the gzip file 
decompresses into 1GB of zeros), since you don't get a chance to limit the 
buffer size.

----- Original Message ----- 
From: "Sara Shoemaker" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, August 27, 2005 1:33 AM
Subject: Using FileSource and ArraySink with Gunzip


> Hi -
>
> I am quite confused.  I need to gunzip a file into
> memory.  If I try to use the filters, I get into a
> quandary about how big to allocate my memory buffer -
> as follows:
>
> char inputFileName = "myFile";
> byte* buffer[ HOW_THE_HECK_DO_I_KNOW ];
>
> FileSource(inputFileName, true,
>             new Gunzip( new ArraySink( buffer,
> sizeof(buffer) ));
>
> Any advice would be appreciated.
>
> Thanks
> -Sara
>
>
>
>
>
> 




Reply via email to