c = "''some shell command''" -- e.g. 'dir' readfrom("|" .. c) -- this part will alway fail in standard Windows compiled binary print(read("*a"))
on the lua-l David Burgess wrote:
On VC6, Lua 4.0.1 from the project menu Goto - "Project/Settings" Tab - "C/C++" Select "All configurations" Edit field - "Preprocessor definitions" and paste at the end of the existing string (which should already have something like "WIN32,_CONSOLE,_MBCS") POPEN,popen=_popen,pclose=_pclose
Also tried with lcc for Windows.
You can add POPEN to the #defines on the Compiler->Settings panel.
There is an issue with _popen, however. The Win32 API documentation says that it will only work in console applications, so if you've embedded Lua in a Windows app, then that's a problem. However, there is a patch , and has been tested in SciTE (this also supplies a 'quiet' version of os.execute).