C讀取default gw IP - Linux
By Jack
at 2010-08-31T14:59
at 2010-08-31T14:59
Table of Contents
如題:
在Linux底下想用 C 把系統的default gw ip讀取出來
目前想到的方法是
FILE* fd ;
char buf[128] ;
fd = popen("route -n","r") ;
fread(buf,sizeof(char),128,fd) ;
再從buf中找出IP
請問是否有更好的方法?
--
Tags:
Linux
All Comments
By Hedy
at 2010-09-04T01:03
at 2010-09-04T01:03
By Faithe
at 2010-09-06T00:49
at 2010-09-06T00:49
Related Posts
看影片卡卡的
By Kelly
at 2010-08-30T22:42
at 2010-08-30T22:42
有關VMware快照還原點的問題...
By Emily
at 2010-08-30T22:22
at 2010-08-30T22:22
請教DNS的設定?
By Kumar
at 2010-08-30T14:30
at 2010-08-30T14:30
SC2 在 Linux 下玩
By Rachel
at 2010-08-30T07:19
at 2010-08-30T07:19
ubuntu 10.04 ADSL無法連線
By Daph Bay
at 2010-08-30T03:11
at 2010-08-30T03:11