原帖由 caijimin 于 2007-8-10 14:48 發(fā)表
man里面自己寫的,
These functions use a static data space; if the data is needed for future
use, it should be copied before any subsequent calls overwrite it.
和inet_ntoa()類似, ...
你用的是什么系統(tǒng)?手冊(cè)描述的比我的系統(tǒng)好。
APPLICATION USAGE
The getprotobyname(), getprotobynumber(), and getpro-
toent() functions may return pointers to static data,
which may be overwritten by subsequent calls to any of
these functions.
原帖由 hohoxu_hao115 于 2007-8-10 14:46 發(fā)表
謝謝。
現(xiàn)在好像有了getprotobyname_r等_r后綴的函數(shù),可能更好一些。不過程序員手冊(cè)里沒有說明。
原帖由 hohoxu_hao115 于 2007-8-10 15:04 發(fā)表
Linux程序員手冊(cè)對(duì)inet_ntoa的空間分配方式有說明。對(duì)getprotobyname好像沒有。
歡迎光臨 Chinaunix (http://72891.cn/) | Powered by Discuz! X3.2 |