[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Quality-of-Life patches
- From: Sean Conner <sean@...>
- Date: Mon, 28 Feb 2022 21:09:48 -0500
It was thus said that the Great Gé Weijers once stated:
> On Fri, Feb 25, 2022 at 4:50 PM Egor Skriptunoff <egor.skriptunoff@gmail.com>
> wrote:
>
> >
> > I'd like to have an option to reopen stdin/stdout in binary mode.
> > It is currently impossible from Lua code.
> > So, Lua scripts are unable to process and generate binary input/output on
> > Windows.
> > Other programs (written on C) read/write binary data in stdout/stdin,
> > but the "lua.exe myscript.lua" process can not be piped to them.
> >
> > It would be useful for "lua.exe" to have an option to force unbuffered
> > binary standard streams.
> > It does not matter how many letters it would consist of.
> >
>
> The problem is that there is no *portable* way of doing this.
Um, freopen()? From the C standard:
If filename is a null pointer, the freopen function attempts to
change the mode of the stream to that specified by mode, as if the
name of the file currently associated with the stream had been used.
It is implementation-defined which changes of mode are permitted (if
any), and under what circumstances.
-spc