Redirecting stdin and stdout in scala

后端 未结 2 523
一生所求
一生所求 2021-01-24 13:05

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

2条回答
  •  广开言路
    2021-01-24 14:05

    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

提交回复
热议问题