How can I redirect STDIN and STDOUT to files?
In C, this would be done like so:
freopen(\"file.in\",\"r\",stdin);
I am looking for some
You can do it using the Java System api. The code is nearly identical for Java and Scala:
System.setIn(new FileInputStream("file.in"))
System.setOut(new PrintStream(new FileOutputStream("file.out")))
Do you mean something like:
import java.io.File
import scala.sys.process._
"cat" #< new File("file.in") !
source: http://www.scala-lang.org/api/2.11.7/index.html#scala.sys.process.package