|
Luiz Henrique de Figueiredo wrote: >...
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.
Not probably - File descriptors are assigned starting with the smallest available. Closing stdin and immediately opening a new file is guaranteed to use file descriptor 0.
Roberto Waltman