On Sun, Jul 31, 2011 at 5:30 AM, Jeffrey Walton <[email protected]> wrote:
> > > On Jul 30, 10:32 am, dirvine <[email protected]> wrote: > > Hi all > > > > I hope you can help. > > > > I am attempting to use messagequeues to store some data and later get > > parts of the data. I thought these would be perfect (some of them are > > defaults in transformations like hash etc.). If I try to do something > > like > > > > size_t qlength = > > main_encrypt_queue_.TotalBytesRetrievable(); // 40 in my test > > byte *i; > > main_encrypt_queue_.Peek(i, qlength);// Get(i); // segfault with > > either get or peek > > > > I am sure I am doing something wrong. I am also using these like > > buffers really and not actual messagequeues (i.e. I am not trying to > > receive messages at a time but bytes) as the notion of messages does > > not fit the piece of code I am attempting. > Try either: > byte *i; > main_encrypt_queue_.Peek(i); > > Or > byte *i; > main_encrypt_queue_.Peek(&i, sizeof(i)); > > See http://www.cryptopp.com/docs/ref/class_message_queue.html. > > Jeff > > Thanks Jeff, from that page virtual size_t Peek<http://www.cryptopp.com/docs/ref/class_buffered_transformation.html#a5fa048faf8c043ad57ae0a8911070090> (byte > &outByte) const peek at the next byte without removing it from the > output buffer > works just fine. I could not seem to get virtual size_t Peek<http://www.cryptopp.com/docs/ref/class_buffered_transformation.html#aacdeedab8dc8557d17b12b67a9ff94dc> (byte > *outString, size_t peekMax) const > peek at multiple bytes without removing them from the output buffer to work. Is it that peekMax is actually a sizeof(byte) then ? Maybe the docs are a little misleading there as it seems to lead you to believe that you will have a pointer to a byte array of size peekMax. As I said I am maybe just misreading this myself, which I am more than happy to contend. David -- 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.
