[pjsip] Copy from a stl string to a pj_str_t struct

Dan dan.aberg at keystream.se
Thu Feb 7 16:04:24 EST 2008



> I’ve figured out this one, but it feels a bit clumsy
> 
>  
> 
>       char* tmpUsername = new char[username.size()];
> 
>       strcpy(tmpUsername, username.c_str());
> 
>  
> 
>       pjsua_acc_config pjsuaAccountConfig;
> 
> pjsua_acc_config_default(&pjsuaAccountConfig);
> 
>       pjsuaAccountConfig.id = pj_str(tmpUserId);
> 
>  
> 
> Any other ideas?
> 

How about:
	pjsuaAccountConfig.id = pj_strdup3 (pool, username.c_str());

/Dan







More information about the pjsip mailing list