Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

bytesink.cpp

A pointless example.

#include <blindfold/ByteSink.h>
#include <iostream.h>
#include <string.h>

char buf[256];

class MyByteSink : public ByteSink {
public:
    virtual void write(const void* data, size_t numBytes) {
    memcpy(buf, data, numBytes);
    }
};

int main()
{
    MyByteSink* x = new MyByteSink();
    x->write("Hello", 6);
    delete x;

    cout << "Hello? " << buf << endl;

    int same = (!memcmp("Hello", buf, 5));
    return same ? 0 : 1;
}

Home to blindfold. This page generated via doxygen 1.2.11.1 Wed Oct 10 16:40:33 2001.