java - Use of writeDouble produces nonsense -
this question extension of discussion found here. goal write 2 formatted columns of arrayed x , y data file (type double
). current attempt accomplish follows:
try { fileoutputstream fos = new fileoutputstream("angle.txt"); dataoutputstream dos = new dataoutputstream(fos); (i = 0; < i_max-1; = + 1) { dos.writedouble(theta[i]); } dos.close(); } catch (ioexception error) { system.out.println("ioexception: " + error); }
this code derived example found here (dataoutputstream). having limited grasp of java, expected work 1 column only; instead produced this:
?¹™™™™™š?¹™™™™™š?¹™™™™™š?¹™™™™™š?¹™™™™™š?¹™™™™™š?¹™™™™™š?¹™...
i don't understand i'm doing wrong. any insights can offer great help.
my next question be: how format not 1 two columns of type double
, formatted ("%1$16.6f, %2$16.6f", time[i], theta[i])
. right i'm following this discussion. however, compiler dislikes approach use of writedouble
.
your , patience appreciated.
streams used write binary data. write textual data, use writers. see java io tutorial: http://docs.oracle.com/javase/tutorial/essential/io/charstreams.html
Comments
Post a Comment