lua-users home
lua-l archive

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


On 17/05/15 20:48, tonyp@acm.org wrote:
> -----Original Message----- From: Pierre Chapuis
>> Sent: Sunday, May 17, 2015 10:44 PM
>> To: Lua mailing list
>> Subject: Re: Is it possible to output LF without CR under Windows? Lua 5.3
>> 
>>> Any ideas how to output LFs only under Windows?
>> 
>> Open the file in binary mode.
>
> No file.  I'm interested in stdout as I want to pipe it to another
> command. Can I re-open stdout in binary mode?

Try:

f = io.open("CONOUT$", "wb")
f:write("test\ntest")
f:close()

(not perfect, and I just tested 'lua test.lua > text.txt', it didn't
work as expected, sent output to the console not the file)

Scott