The following line of code produces a compiler warning with HP-UX's C++ compiler:
strcpy(var, "string")
Output:
error #2167: argument of type "unsigned char *"
is incompatible with parameter of type "char *"
Please note: var
is the unsigned char *
here - its data type is outside of my control.
Two questions:
- What does incompatibility mean in the context of these two types? What would happen if the compiler was forced to accept the conversion? An example would be appreciated.
- What would be a safe way to make the above line of code work, assuming I have to use
strcpy
?