|
|
||
|
We may add freopen (actually, as an ANSI C facility, it deserves to be in iolib), but we still must correct the problem of accessing a closed stdin (even after a reopen).
I have attached a sample program for windows that shows how the
invalid stdxxx detection works.
However, what about in liolib.c of putting back the checks in f:close()
so that io.stdout is set to nil when we close it. It would seem to be
a simple solution that would generate consistent behaviour - no?
<sample prog>
#include <windows.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
HANDLE h;
fclose(stdout);
h = _get_osfhandle(_fileno(stdout));
fprintf(stderr, "handle %08X\n",h);
return 0;
}