Re: constructor problem

From: Vince Morgan (vir_at_optusnet.com.au)
Date: 03/26/05


Date: Sat, 26 Mar 2005 12:18:08 +1000


"Andrey Tarasevich" <andreytarasevich@hotmail.com> wrote in message
news:11493oes2h5asaa@news.supernews.com...
> tsunami wrote:
> > ...
> > I am trying to write a BitArray class;one of my constructors take
> > string stream such as:
> > BitArray d="1010101010";
> > I want to pass this "101010" into my constructor but it gives a
> > conversion error such as cannot convert to 'char *' to 'unsigned char
> > *' where I have defined my bitarray as:
> > unsigned char* bitarray;
> > I am including the BitArray constructor that I have written:
> >
> > 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

Please excuse my ignorance, but aren't there issues with regard to using
signed types in a bit array?

Vince Morgan



Relevant Pages

  • RE: Base EDI adapter: COM_SendMessage eternal loop error
    ... Very best regards, ... > with Microsoft PSS to request this fix. ... For every EDI ... > Subsystem starts generating the error message shown below with a frequency ...
    (microsoft.public.biztalk.general)
  • Re: Error Message when I log on
    ... clg wrote: ... My computer came up clean but when I rebooted, the Error message is still there! ... Now it suggests I buy the Drive Scanner program. ...
    (microsoft.public.windows.mediacenter)
  • Re: Same Problem The compiler failed with error code 128 for me too
    ... They have some updates on this one, but if this is with your hosting ... > The same error message is coming for me Please send me any solution ... >> I'm basically deploying a new website into an area at a web hosting ... >> Many thanks and best regards, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: jet database error when importing external txt data
    ... <Access MVP> ... > mentioned error message. ... > Regards. ... >>Jeff Boyce ...
    (microsoft.public.access.externaldata)
  • Re: Mystic - "page cannot be displayed"
    ... > There is no status code, but the error message is: ... >> Regards, ... >> Bernard Cheah ... >>> I should mention that the site doesn?t use user isolation, ...
    (microsoft.public.inetserver.iis.ftp)