看板 EE_DSnP 關於我們 聯絡資訊
※ 引述《ric2k1 (Ric)》之銘言: : 關於 "dofile" 這個 command 的 support, 有鑒於兩個先天上的 limits: : 1. MAX_HISTORY = 65536 : 2. In Linux systems, the number of file descriptors is limited to 1024. : That is, the maximum number of files we can open is 1024. You can see : this by the "limit" command. However, it seems that we canot increase : this limit over 1024. 老師 我有幾個問題想請教~ 我試了一下 [do4] 結果我發現depth只能到1021個 由於對 file descriptor 不是很懂 所以我找了一些資料 就我目前的了解 一個程式被執行會開啟三個 descriptor 0:standard in 1:standard out 2:standard error 所以在Linux的default limit下 我們的_dofileStack的size其實最多也只能有 1021 所以老師要我們設定1024其實是多餘的@@? 另外我想要看看在recursive的開檔下 每個do4被開啟後的file descriptor是多少 測試一下 是不是剛好從 3 ~ 1023 可是我試了一下 也找了些資料 好像沒辦法從 ifstream 這種物件中 知道file descriptor? 另外一方面在 stdio.h 中有提供了 int fileno( FILE* stream ); 可以回傳file descriptor 於是我很天真的試著將_dofile用static_cast<FILE*>或是(FILE*)轉成 FILE* 不過這樣好像不行 fileno 會回傳 -1 看來是compiler提供的 型別轉換 不夠威@@? 想想 也是挺很合理 ifstream是C++的產物 而FILE是C下的東西~ 所以所以 我有辦法看 ifstream 的 file descriptor嗎? 謝謝老師 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.18.225
yangjiunru:http://www.ginac.de/~kreckel/fileno/ 04/15 18:43