Working with string - back to null terminated

GO
Gabriel Ortiz Lour
Wed, Jun 6, 2012 8:49 PM

Hi all,

Just a PJ begginer question. What's the best way to get null terminated
strings from pj_str_t to be able to do something like:

sprintf(buffer, "Incoming call from: %s", ci.remote_info.ptr);
(this does not work since its not null terminated)

Thanks,
Gabriel

Hi all, Just a PJ begginer question. What's the best way to get null terminated strings from pj_str_t to be able to do something like: *sprintf(buffer, "Incoming call from: %s", ci.remote_info.ptr);* (this does not work since its not null terminated) Thanks, Gabriel
PZ
Pavel Zalunin
Wed, Jun 6, 2012 8:52 PM

Hi.

sprintf(buffer, "%.*s", ci.remote_info.slen, ci.remote_info.ptr)

06.06.2012 23:49, Gabriel Ortiz Lour ?????:

Hi all,

Just a PJ begginer question. What's the best way to get null
terminated strings from pj_str_t to be able to do something like:

sprintf(buffer, "Incoming call from: %s", ci.remote_info.ptr);
(this does not work since its not null terminated)

Thanks,
Gabriel


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi. sprintf(buffer, "%.*s", ci.remote_info.slen, ci.remote_info.ptr) 06.06.2012 23:49, Gabriel Ortiz Lour ?????: > Hi all, > > Just a PJ begginer question. What's the best way to get null > terminated strings from pj_str_t to be able to do something like: > > *sprintf(buffer, "Incoming call from: %s", ci.remote_info.ptr);* > (this does not work since its not null terminated) > > Thanks, > Gabriel > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org