Parsing a string to get the ip address
Hello
g++ (GCC) 4.6.2
I have a string that I need parse. The string is sdp information. I am trying to seperate each of the elements into seperate strings.
Basically the string would contain some thing like this:
Code:
v=0 o=sip_user IN 10230 22472 IP4 NET.CAT.NTBC s=SIP_CALL c=IN IP4 10.10.10.44 m=audio 49152 RTP/AVP 0 8 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000
What is the best method to get the ip address?
I was trying something like this:
Code:
char *ip_addr = NULL
str_v = strstr(sdp_string, "c=");
if(ip_addr != NULL) {
printf("found line: [ %s ]", ip_addr);
}
Many thanks for any suggestions,