Reputation: 3940
Given the following code:
import scala.io.Source
object Demo {
def func():Unit = {
for ( line <- Source.fromFile("C:\Users\Hen\Scala_workspace\Itay\src\Demo.scala").getLines() ) {
println(line)
}
}
def main(args: Array[String]): Unit = {
//var x=args(0).toInt;
func();
}
}
Why is the pathname marked as a compilation error?
Eclispe won't let me run it
Upvotes: 1
Views: 88
Reputation: 25874
Try triple quotes around your path, so that scala will not interpret \ + char
as special characters:
"""C:\Users\Hen\Scala_workspace\Itay\src\Demo.scala"""
Upvotes: 7