tsunami wrote:
I have written a bitarray class which has a constructor taking bit
stream as a string parameter.but it gives me an error such that cannot
convert 'char*' to 'unsigned char*'.where I have declared bitarray as:
unsigned char *bitarray; and the constructor is:
BitArray::BitArray( const char* inputsize)
{
bitarray=new char[strlen(inputsize)+1];
strcpy(this->bitarray,inputsize);
this->length=strlen(inputsize);
return;
}
'strcpy' expects a 'char*' as its first argument and you are trying to
pass a 'unsigned char*' instead. That's what's causing the error message.
It is hard to suggest a way out of this since your intent is not exactly
clear from the code provided. If you are planning to store an ASCII
representation of your "bit array" in the memory pointed by
'this->bitarray' (which is a rather strange way to implement a bit
array), why don't you just declare 'bitarray' field as a 'char*'?
--
Best regards,
Andrey Tarasevich