[EMAIL PROTECTED] wrote:
>
> Yes I have flushed the writer. As I wrote earlier I can read & write to
> another separate Java program but not C-program.
>
> Onething I forgot to say though. I'm developing this program in Win98
> platform although end of the day i have to run it on a Linux machine
> for my university project. But I'm unable to test this on linux yet as
> JDK is not ready on the Linux machine yet. Just thinking if this is a
> MS problem?
>
> I will be happy to know if someone had ever read & wrote to a console
> based C -program from within a Java program in Linux platform (or
> Win98)?
>
> THanks for your tip anyway..
>
> -Mak
Yes, I use the following and it works under Linux Kernel 2.2.10 SuSE
Dist 6.1.
private int exec( String _command , String logname, boolean lock)
{
Runtime rt = Runtime.getRuntime();
Process proc = null;
int exitValue = 0;
try {
String line;
proc = rt.exec( _command );
BufferedReader brstdout = new
BufferedReader( new InputStreamReader( proc.getInputStream() ) );
BufferedReader brstderr = new
BufferedReader( new InputStreamReader( proc.getErrorStream() ) );
while ( ( line = brstderr.readLine() ) != null ) log( logname, line
);
while ( ( line = brstdout.readLine() ) != null ) log( logname, line
);
if ( lock )
exitValue = proc.waitFor();
}
catch ( IOException ioe )
{
log( logname, ioe.getMessage() );
}
catch ( InterruptedException ie )
{
log( logname, ie.getMessage() );
}
return exitValue;
--
---
Cengiz Tuztas
Dipl. - Wirt. Inform.
ADA - Das SystemHaus GmbH
Berliner Platz 12 - 41061 Mönchengladbach
Tel.: 0 21 61 / 655 - 7247, Fax: -7216
---
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]