需要转换NSString* str
到char* ch
,这样做是为了将其当做函数的参数使用,str
是在UITextField
获取的。
void CUserSession::Login (char *pUsername, char *pPassword)
首先使用ch = [str UTF8String];
之后,
得到错误:
Cannot initialize a parameter of type 'char *' with an rvalue of type 'const char *'
后来改为这样ch = (const uint8_t *)[str UTF8String];
得到错误:
Cannot initialize a parameter of type 'char *' with an rvalue of type 'const uint8_t *' (aka 'const unsigned char *')