作者yehes2001 ()
看板EE_DSnP
标题Re: [公告] "dofile" command 的测试范围
时间Wed Apr 15 18:01:28 2009
※ 引述《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