java.lang.Runtime()

I made a small addition program using 'C'. It accepts 2 no.s and produces the result.

how can i send the 2 no.s to the C program? Here is the code i tried:

Runtime r=Runtime.getRuntime();

Process p=r.exec("add.exe");

InputStream ios=p.getInputStream();

OutputStream ops=p.getOutputStream();

String a="1\n", b="2\n", text;

ops.write(a.getBytes());

ops.write(b.getBytes());

BufferedReader br=new BufferedReader(InputStreamReader(ios));

while ( (text=br.readLine())!=null)

System.out.println(text);

I'm neither getting any output nor any error. What do i do? Plz help and thanks in advance.

[843 byte] By [Aswin] at [2007-9-30 20:53:51]
# 1
[code[ops.write(a.getBytes());ops.write(b.getBytes());ops.flush();[/code[
BIJ001 at 2007-7-7 2:26:41 > top of Java-index,Administration Tools,Sun Connection...
# 2
[code[ops.write(a.getBytes());ops.write(b.getBytes());ops.flush();[/code[
BIJ001 at 2007-7-7 2:26:41 > top of Java-index,Administration Tools,Sun Connection...
# 3
Maybe this time:[code]ops.write(a.getBytes());ops.write(b.getBytes()); ops.flush();[/code[
BIJ001 at 2007-7-7 2:26:41 > top of Java-index,Administration Tools,Sun Connection...
# 4
Hi!! thanks that worked out.
Aswin at 2007-7-7 2:26:41 > top of Java-index,Administration Tools,Sun Connection...