请推荐一种在Java中获得与我们在C中进行freopen("filename","r",stdin)或freopen("filename","w",stdout)时类似的行为的方法。
发布于 2010-05-08 19:39:57
假设这是重定向stdin/stdout/stderr,看看System.setIn和朋友们。它们允许您将不同的InputStream和PrintStream分配给System.in、System.out和System.err。
发布于 2011-01-15 22:07:48
请参阅下面的网页。对于你想做的事情,有一个解决方案。
http://techtipshoge.blogspot.com/2011/01/connect-standard-io-to-files.html
https://stackoverflow.com/questions/2793862
复制相似问题