Lvalue error.Help!!

strcpy(sendbuffer,(char*)&this);

I wrote the above statement in a member function of a class but it shows an error
"lvalue required as unary '&' operand".sendbuffer is a char array of 500 length.I want to typecast the object in a character array and then put it in a character array named sendbuffer.can anyone suggest anything.
this is already a pointer to the object. It is a constant and is not contained in memory (for all you care) and therefore you can't get its address. Just remove the &.
Note that strcpy is made for strings and will stop copying bytes when it finds a null character '\0'. If you want to copy all the bytes of the object pointed to by this it's better to use memcpy.
@hamsterman u were right thanx for the help.thanx to peter87 too.
Topic archived. No new replies allowed.