lua-users home
lua-l archive

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


----- Original Message -----
From: "Martin Spernau" <martin@traumwind.de>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Tuesday, August 20, 2002 2:52 PM
Subject: lua system interaction on win


> Hello list!
>
> I have a problem that seems to be rather simple for *IX systems that have
> pipes, but I need to do this in windows.
>

] ... SNIP ... [

>
> Now lua compiled for Windows doesn't support the '| command' functionality
> for readfrom(), as it doesn't have 'pipes'
>

Actually, I would like to point out that Windows _DOES_ have pipes, but
the API to use them is not at all like the Un*x API.

If your intrested, the following link to MSDN discusses them:
http://msdn.microsoft.com/library/en-us/ipc/base/pipes.asp

>
> Of course one could use a construct like
> execute("dir > temp.txt")
> readfrom("temp.txt")
> o = read("*a")
> print(o)
>
> But is there a nicer way to do that in Windows?
> (I've done this kind of thing from VB, using the win32 API...)
> Or would I need to handle this in some platform specific lib?
>
> I'd be happy for any ideas/pointers
>

Obviously I can see how the "| command" method would be a nice
shorthand, and would be cleaner (no temp files to have to clean
up).

Have you by chance tried compiling Lua using the Cygwin compiler?
This might correct the issue as Cygwin emulates many Un*x based
functions.

Just short of that, I think you'll need to write your own library
to do this.

As I stated, the Win32 pipes aren't progmaticaly the same as Un*x
pipes, and to add support for them in the I/O library would mean
having to put in a fairly heafty chunk of platform specific code.

Kelmar K. Firesun (IRL: Bryce Simonds)