When you declare a pointer you must allocate memory to it..
eg...
char * pData;
pData = new char[20];
This is rather simple but it emphasizes the point that we have now allocated effectively 20 bytes of memory which we can then memcpy into.
Alternatively if you have a data structure to accept TGA files
Code:
struct TgaHeader {
char IDLen; //length of ID field
char MapType; //0=none, 1=present
char ImgType; //0=none, 1=c-map, 2=true, 3=b&w, 9=rle c-map, 10=rle true, 11=rle b&w
short FirstColor; //where to start in colormap
short MapLen; //number of colors to set
char EntrySize; //number of bits per color entry
short Xorigin;
short Width;
short Height;
char Depth;
char Descriptor;
};
When we want to load a new TGA we will declare a pointer to the texture
But we then must allocate memory to it
Code:
pTGA = new TgaHeader;
In your example above you declare void * buf but you never tell it how much memory you want to reserve for buf
Something like this might work...although my c++ skills are rather limited
Code:
unsigned uDecompressBuffer[ MAX_CAPTURE_SIZE];
pbufPointer = (unsigned *)(((char *)&uDecompressBuffer) );
buf = (void *)pbufPointer;
Where you can define a max capture size in the h file. Alternatively if you know what the capture size is replace MAX_CAPTURE_SIZE with a variable that is at least equal to the size of the capture stream