lua-users home
lua-l archive

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


On Tue, Mar 1, 2022 at 5:10 AM Sean Conner wrote:
It was thus said that the Great Gé Weijers once stated:
>
> 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

MSVCRT Seems to not allow filename to be NULL
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/freopen-wfreopen?view=msvc-140

But we actually do not need a "portable way".
Windows is the only OS where such functionality is needed.
On other modern OSes there is no difference between text mode and binary mode,
so the new option should be simply ignored there.