Tools.h++ Class Reference

Table Of Contents
Public Member Operator
operator unsigned long();
Provides the count of bytes seen so far.
Public Member Function
unsigned long
reset(unsigned long value = 0);
Resets the count of bytes seen so far. Returns the current count.
Extended Example
#include <iostream.h>
#include <fstream.h>
#include <rw/auditbuf.h>
#include <rw/pstream.h>
#include <rw/cstring.h>
void doCrc (unsigned char c, void* x) {
*(unsigned char*)x ^= c;
}
int main() {
if(1) { // just a block to control variable lifetime
unsigned char check = '\0';
// create an output stream
ofstream op("crc.pst");
// create an RWAuditStreamBuffer that will do CRC
RWAuditStreamBuffer crcb(op,doCrc,&check);
// create an RWpostream to put the data through.
RWpostream p(&crcb);
// now send some random stuff to the stream
p << RWCString("The value of Tools.h++ is at least ");
p << (int)4;
p << RWCString(" times that of the next best library!\n") ;
p << RWCString("Pi is about ") << (double)3.14159 << '.';
// finally, save the sum on the stream itself.
p << (unsigned int)check; // alters check, _after_ saving it...