Please suggest a method to obtain a similar behaviour in Java as when we do freopen("filename","r",stdin) OR freopen("filename","w",stdout) in C.
+2
A:
Assuming that this is to redirect stdin/stdout/stderr, have a look at System.setIn and friends. They allow you to assign a different InputStream and PrintStream to System.in, System.out and System.err.
Thomas
2010-05-08 11:39:56