lua-users home
lua-l archive

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


Title: Re: Why cann't capture the stdout

Hello Andy.Tao,

Hi Andy!


Not answering your question, but just a hint: probably you can consider usage of io.write() instead of print? 


Regards, Dennis



Hi gus,


I have meet a trouble, does anyone could help me? 


I embeded lua in my MFC program, and create pipe to receive lua stdout text, it can receive error message but print, why? code context is:


1. Create Pipe: CreatePipe(&PipeRead, &PipeWrite, NULL, 0)

2. Assign pipe write handle to stdout and stderr:

_dup2(_open_osfhandle(PipeRead, _O_TEXT), 1)

_dup2(_open_osfhandle(PipeRead, _O_TEXT), 2)

3. Create thread to read pipe read handle

4. Execute lua code which contain statement: print and error

5. It can receive statement(error) message but print


thanks in advanced!



------------------

Andy Tao[陶祖洪]

祖洪测试自动化 http://www.zuhong.cn

天是圆的,地是方的,凡事都要有个规矩!





-- 

Best regards,

 Dennis                            mailto:dp@xeepe.com