TTL for IP addr from DNS through C code

Hi All,
I know that getaddrinfo() return the multiple IP addresses (if present) for a hostname. But, I want to know how to get the TTL value for this list from DNS. I want to get this TTL value and cache this IP address list for that much time and then again go for DNS resolution if TTL expires.

Have any body come across such solution.Plz reply.

Thanks ...

Hint:

Look at the source code for traceroute

Hi,
I just went through the "traceroute" code straight away. But, could not get much help. Can you me give some pointers through any sample code that you would have.

Thanks a lot.