On Thu, 21 Jul 2011 16:19:12 +0300, Maraco <[email protected]> wrote:

Hello.

I have a specific problem. I need to redirect console output from a
console program to dfl textbox but i cant find function to do it.
std.process.system only shows exiting code. I think
std.process.shell should do it but it is crashing whole program.

If You don't know what im asking for there's code how i've done it
in C#:

*CODE BEGINS
Process p = new Process();
            p.StartInfo.FileName = "shutdown";
            p.StartInfo.Arguments = " /?";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.CreateNoWindow = true;
            p.Start();

            string output = p.StandardOutput.ReadToEnd();

            textBox3.Text = output;
*CODE ENDS

Can you provide me an idea what im doing wrong or alternative to
popen in D langauge?

Regards.

This functionality is currently not implemented in D's standard library.
Lars Kyllingstad implemented this in his version of std.process, but only supporting the POSIX API.
For Windows, you'll need to do it manually, in the same way as in C:
http://msdn.microsoft.com/en-us/library/ms682499(v=vs.85).aspx

(In my own projects, I just redirect the output to a temporary file.)

--
Best regards,
 Vladimir                            mailto:[email protected]

Reply via email to