lua-users home
lua-l archive

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

Luiz Henrique de Figueiredo <> writes:

>> 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.

It is actually an old idiom in Unix to close those file descriptors
and expect them to open from the beginning.  It predates doing this by
dup2 and similar calls.

David Kastrup