Hi Kan, > I feel it's impossible... :( Not impossible - you simply have not found an adequate solution.
> It reads whole file into the rslt, all goes into memory. > I try to avoid it. How would you do this _without_ the compressed or encrypted stuff? > ctx->pump->Pump(1234); http://www.cryptopp.com/fom-serve/cache/29.html Jeff On 1/25/07, kan <[EMAIL PROTECTED]> wrote: > > On Jan 25, 5:34 pm, "Jorge Marques Pelizzoni" <[EMAIL PROTECTED]> > wrote: > > > One way to do it is exemplified below. > ... > > string rslt; > > { > > FileSource fs(is, true /* automatically call PumpAll */, > It reads whole file into the rslt, all goes into memory. I try to avoid > it. > For instance, if I have a big file, say 500mb and want to read a line > number 12345 I don't need to read whole file into memory, I may just > skip 12344 lines. > > I feel it's impossible... :( > I have only idea something like this, may be it's best possible > solution: > > struct InputReadCallbackContext > { > CryptoPP::Source *pump; > CryptoPP::BufferedTransformation *source; > }; > static int xmlInputReadFromStreamCallback(void *_ctx, char *buffer, int > len) > { > using namespace CryptoPP; > InputReadCallbackContext *ctx = (InputReadCallbackContext *)_ctx; > try > { > ctx->pump->Pump(1234);// Just a random number!!! And difficult > to > understand what should be here. > return ctx->source->Get((byte *)buffer, (size_t) len); > } > catch(Exception &e) > { > return -1; > } > } > > ... > FileSource source("a file", false); > InputReadCallbackContext ctx; > ctx.pump = &source; > source.Detach(ctx.source = new ZlibDecompressor); > xmlDocPtr doc = xmlReadIO(xmlInputReadFromStreamCallback, ... &ctx, > ...); > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [EMAIL PROTECTED] More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
