roeder@robin.cs.uni-sb.de (Edgar &) (10/29/90)
In article <7531.2728a749@uwovax.uwo.ca> 7103_2622@uwovax.uwo.ca (Eric Smith) writes: > In article <1990Oct24.164834.21929@doe.utoronto.ca>, david@doe.utoronto.ca (David Megginson) writes: > > > > The program runs under TOS and MiNT, but not under RTX (which prints the > > error message). The reason is that the Gnu freopen() function in this case > > attempts to close the standard handle associated with stdout, which > > (correctly) causes an error under RTX, while TOS and MiNT are a little > > more lenient. > > > "Correctly?" I can recall no TOS documents that forbid closing handle 0. > Since TOS does permit it, I would conclude that closing stdout should > cause no error. Note that Unix works the same way. Wether RTX correctly generates an error or not, the problem is still in the freopen() function. The ANSI standard says that a failed close on the old file should be "silently ignored". So if freopen would conform to the ANSI standard, neither RTX nor TOS/MiNT should cause any problems. BTW: The gcc library and executables on cs.uni-sb.de should have no problems with RTX (at least not this one caused by freopen), since the used freopen implementation conforms to ANSI-C. - Edgar