On Fri, 25 Mar 2005 19:31:48 +0100, Markus Sch�nhaber
<[EMAIL PROTECTED]> wrote:
> Am Freitag, 25. M�rz 2005 18:51 schrieb Steve Butcher:

> Does vlc produce any output on stdout/stderr? If it does, it may stop when the
> output-buffer fills up. So you have to read Process#getOutputStream() to make
> it continue.

that makes more sense! It's been a while since I've played with this
stuff... Below is a snippet of code I used in a spellchecker
application that you can look at for ideas:

try

        {   

                        

            String osName = System.getProperty("os.name" );

                //System.out.println("OS Name: " + osName);

            String[] cmd = new String[3];

 

            if( osName.equals( "Windows NT" ) | osName.equals( "Windows 2000" ))

            {

                cmd[0] = "cmd.exe" ;

                cmd[1] = "/C" ;

                cmd[2] = "aspell -a";

            }

            else if( osName.equals( "Windows 95" ) )

            {

                cmd[0] = "command.com" ;

                cmd[1] = "/C" ;

                cmd[2] ="aspell -a";

            }

            

            Runtime rt = Runtime.getRuntime();

            System.out.println("Execing " + cmd[0] + " " + cmd[1]

                               + " " + cmd[2]);

            Process proc = rt.exec(cmd);

 

                PrintWriter stdin = new
PrintWriter(proc.getOutputStream(), true);

                stdin.write(spellCheck);

                //System.out.println(spellCheck);

                //stdin.write(26);

                stdin.close();

            

                InputStreamReader isr = new
InputStreamReader(proc.getInputStream());

            BufferedReader br = new BufferedReader(isr);

            String line=null;

                int i = 0;

                try {

            while ( (line = br.readLine()) != null) {

                        if (line.equals("*")){

                                    aSuggWords[i] = "correct";

                        }else{

                                    aSuggWords[i] = line;

                        }

                //out.println(line + "<br>");

                        returnString = returnString + "<br>" + line;

                        i++;

                        }

            } catch (IOException ioe)

              {

                ioe.printStackTrace();  

              }

                proc.destroy();

Regards,


-- 
Jason Bainbridge
http://kde.org - [EMAIL PROTECTED]
Personal Site - http://jasonbainbridge.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to