Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback on: irt.org FAQ Knowledge Base Q1486, September 03, 2002 at 00:23:19:

You are here: irt.org | About | Feedback | 4118 [ previous next ]

Feedback on:
irt.org FAQ Knowledge Base Q1486

Sent by
Mike Weerdenburg on September 03, 2002 at 00:23:19:

Length:
Too short

Comments:
If you want to grab the output from an executable then use the following code:

// You need the following imports...
import java.lang.System;
import java.lang.Runtime;
import java.io.IOException;

// The executable...
String strFile = "c:/test.exe";

// The output of the executable...
String strResult = "";

Process obProcess = null;

// Byte-Counter...
int intByte = -1;

// Runtime Environement
Runtime obRuntime = Runtime.getRuntime();

try
{
obProcess = obRuntime.exec( strFile );
InputStream obInputStream = obProcess.getInputStream();
intByte = obInputStream.read();
while ( intByte != -1 )
{
strResult += ( char ) intByte;
intByte = obInputStream.read();
}
}
catch ( Exception e )
{
System.out.println("Error : " + e);
}
System.out.println("strResult : " + strResult);


Other feedback on 'irt.org FAQ Knowledge Base Q1486' - show all

©2018 Martin Webb