1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
int write( void *in, int insize, int count )
{
if( !isbinary ) return size;
int adsize = insize * count;
char *ad = new char[adsize];
ad = (char *)in;
char *p = new char[size + adsize];
if(size)
{
spstr::copy( p, size + adsize, data, size );
delete data;
}
data = p;
spstr::copy( size, data, size + adsize, ad, adsize );
size = size + adsize;
}
int read( void *out, int outsize, int count )
{
if( pos >= size ) return -1;
char *d = new char[outsize*count];
spstr::copy( pos, d, outsize*count, data, size );
out = (void *)&d;
pos += outsize*count;
return pos;
}
|