最近,需要在linux開發daemon程式
也找到開發時必須注意的事
其中一項是建立子行程後必須關閉所有的fd
想用fcloseall()達成目的
問了一下男人,如下連結
http://man7.org/linux/man-pages/man3/fcloseall.3.htmlfcloseall()也會關閉stdin, stdout, and stderr這三個
所以我做了如下測試
int main(){
fcloseall();
fprintf(stdout,"hello\n");
return 0;
}
不是stdout會關閉嗎
執行之後還是有顯示hello
這是怎麼一回事
是我理解錯誤了嗎