Thursday 27 November 2008

HOWTO: jython(java) calling c program in console

import java.lang

proc=java.lang.Runtime.getRuntime().exec("c:\\app.exe") // this app.exe is compiled from c
br=java.io.BufferedReader(java.io.InputStreamReader(proc.getInputStream()))
print br.readLine()
java.lang.System.out.println("last line")

=========================
Why not using os.popen() from python, is because there is a bug about calling popen. :)

No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter