Link to home
Start Free TrialLog in
Avatar of Soth
Soth

asked on

convert unsigned char[] to const char

just say I have the following variable defined as:

unsigned char label[32];

now in my program i want to call the following:
SetDlgItemText(IDC_STATIC, label);

but this gives the error:
"cannot convert parameter 2 from unsigned char[32] to const char *"

so how can I convert my unsigned char label[32] to a const char *??

ASKER CERTIFIED SOLUTION
Avatar of Norbert
Norbert
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of VEngineer
VEngineer


Using the standard C++ casting operator 'static_cast' instead of old C style cast notation:

SetDlgItemText(IDC_STATIC, static_cast<const char*>(label) );
Avatar of Soth

ASKER

worked like a charm!
thanx
what is the adtvantage usining static_cast ?