lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> For windows:
> 
>   _get_osfhandle(_fileno(stdout))  > 0
> 
> means valid.

Unix has fileno, but if stdio is recycling FILE* then it probably is also
recycling filenos. So opening a file right after closing stdin will probably
create a file whose fileno is 0. That's the whole problem. As far I can see,
there is no reliable way to tell whether a FILE* or fileno corresponds to
the original stdin that was open when the process started.
--lhf