How to Append the text file using stored value variable in Scala -
i want append line @ end of text file without using loop or array. tried following code gives me error.
import scala.io.source import java.io._ var valueone:int=15 var valuetwo:int=16 var valuethree:int=20 val fw = new filewriter("text file", true) ; fw.write(valueone.tostring,valuetwo.tostring,valuethree.tostring) ; fw.flush fw.close() here error
error:overloaded method value write alternatives: (x$1: string,x$2: int,x$3: int)unit <and> (x$1: array[char],x$2: int,x$3: int)unit cannot applied (string, string, string) i wanted write output in format in text file:
11,92,20 19,21,34 15,16,20 anybody can me
method write takes 1 string argument, need combine values string:
fw.write( seq(valueone, valuetwo, valuethree).mkstring(",") ) you can using mkstring method.
Comments
Post a Comment