Routing Tables

Hi all,

How can I read routing tables within my own program? I thought of using either a routing socket or a sysctl(), but I can’t find what I need in the online docs. Can anybody give an example of how to do it, preferably with one of the above methods?

Thanks,
Kevin