lua-users home
lua-l archive

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

On Tue, Apr 17, 2007 at 02:12:06PM +1000, David Burgess wrote:
> if closing stdin/stderr/stdout I would have thought the friendly
> thing to do would be to assign it to NULL,
> fclose(stdin);
> stdin=NULL;
> This solves the problem on many systems.

Wouldn't this wreak havoc with libs that expect stdin/out to always
exist?  Unix systems more typically freopen() the std file streams to
/dev/null, so libraries aren't so surprised. I think dos/windows has a
null device, too. Called "NUL:"?

  The primary use of the  freopen()  function is to change the file
  associated with a standard text stream (stderr, stdin, or stdout).
  The fopen() and freopen()  functions  conform  to  ANSI  X3.159-1989
  (‘‘ANSI  C’’).

  freopen(3) on Linux

lua doesn't support freopen(), perhaps it should.