pj_str_t to char*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



P.J. Cast. wrote:
> If you are using C++, you can simply do:
> std::string mystring(pj_str.ptr, pjs_str.slen);
> 
> If you are using C, you could write a simply little
> function easily enough. Though, I'm not sure if pjsip
> has a built in function. 

There are some actually:

PJ_IDECL(pj_str_t*) pj_strdup_with_null(pj_pool_t *pool,
					pj_str_t *dst,
					const pj_str_t *src);
PJ_IDECL(pj_str_t*) pj_strdup2_with_null(pj_pool_t *pool,
					 pj_str_t *dst,
					 const char *src);
PJ_IDECL(pj_str_t*) pj_strncpy_with_null(pj_str_t *dst,
                                          const pj_str_t *src,
					 pj_ssize_t max);

With these functions, dst->ptr would be null terminated.

cheers,
  -benny



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux