[問題] 執行exit()後,關於系統所執行的fflush()

看板C_and_CPP作者 (咕啾咕啾魔法陣)時間15年前 (2010/06/05 22:22), 編輯推噓2(202)
留言4則, 3人參與, 最新討論串1/1
環境:freebsd、g++ http://nopaste.csie.org/fce07 原本程式 http://nopaste.csie.org/da49a dll 輸出: pid:94163 stdin:14194208 stdout:14194512 stderr:14194816 pid:94163 14194512 pid:94163 14194816 pid:94163 14194816 pid:94163 14194512 pid:94163 14194816 pid:94163 14194816 利用LD_PRELOAD覆蓋原本的fflush() 看總共執行了幾次fflush() 雖然有關閉stdout跟stderr的動作 但不懂的是為何執行了6次那麼多 如果說關的是不同的stream也就算了 可是這裡關的只有stdout跟stderr -- C++ hello world標準寫法 http://nopaste.csie.org/fee97 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.134.226.149

06/06 01:55, , 1F
我覺得是 CRT 的不同地方做的...
06/06 01:55, 1F

06/06 01:56, , 2F
也許我在呼叫什麼東西之前為保險先 fflush 一下
06/06 01:56, 2F

06/06 09:48, , 3F
時間到或buf存了多少就會送出了
06/06 09:48, 3F

06/06 14:04, , 4F
exit()後本來就會殖行fflush啊
06/06 14:04, 4F
文章代碼(AID): #1C2bshXB (C_and_CPP)