Regarding _popen() in windows 2000

Hi All,

I have a console application. In windows 2000, _popen() is returning
invalid handle. I checked the same app with 2003 Server, its working
fine.

Please suggest ....

Thanks !

Are you talking about IO.popen? I didn't think Ruby used _popen()
behind the scenes, but it's been a while since I looked. The _popen()
function is basically broken on Windows. From MSDN:

"If used in a Windows program, the _popen function returns an invalid
file pointer that will cause the program to hang indefinitely. _popen
works properly in a Console application. To create a Windows
application that redirects input and output, see "Creating a Child
Process with Redirected Input and Output" in the Platform SDK."

Regards,

Dan

···

On Sep 14, 12:05 pm, painulya...@gmail.com wrote:

Hi All,

I have a console application. In windows 2000, _popen() is returning
invalid handle. I checked the same app with 2003 Server, its working
fine.

Thanks a lot! The problem is resolved by setting /MD flag.

···

On Sep 15, 12:38 am, Daniel Berger <djber...@gmail.com> wrote:

On Sep 14, 12:05 pm, painulya...@gmail.com wrote:

> Hi All,

> I have a console application. In windows 2000, _popen() is returning
> invalid handle. I checked the same app with 2003 Server, its working
> fine.

Are you talking about IO.popen? I didn't think Ruby used _popen()
behind the scenes, but it's been a while since I looked. The _popen()
function is basically broken on Windows. From MSDN:

"If used in a Windows program, the _popen function returns an invalid
file pointer that will cause the program to hang indefinitely. _popen
works properly in a Console application. To create a Windows
application that redirects input and output, see "Creating a Child
Process with Redirected Input and Output" in the Platform SDK."

Regards,

Dan