Re: Best Way To Access Ubuntu Routing Table Details
Originally Posted by
jeraldpaul
I am working on a project which has something to do with working on the kernel routing table.
If it's homework, you can say so.
1. I believe that routing table is stored at /proc/net/route and we
cannot access its size through the C programming method struct stat
Why would its size help? If you could get the size that would be the number of characters.
2. I use
popen to read the output of one of the following command to get the size of the routing table:
Why not just open the file and read it in C?
I think you misunderstand you the pipe works. Also "wc -c" will give the number of characters, which is not what you want.
3. So I am using the
wc with the plugs
-c and
-l to do my stuff I am doing but I believe it is really inefficient if my routing table has millions of entries and if I do this wc thing very frequently
Make it work, then make it work well is an old adage, but still a good one.
Please create new threads for new questions.
Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].
Bookmarks