Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

output filestream  RSS feed

 
Aravind Iyengar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having trouble printing into a file. I'm using a method for printing onto an output strream. Using PrintWriter for printing on the screen - using System.out as argument, and for printing into a file - using another PrintWriter instantiated using a File as argument.
While the code prints the contents onto the screen properly, it aborts printing into the file arbitrarily. I'm printing a huge matrix into a file(I'm using the Jama- Java matrix package) of size around 4000 x 50. And it stops writing the file at the exact same instant in every run - it prints around 3800 x 50 and exits - no errors, warnings or exceptions.
I'm not able to figure out why this is happening.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you properly close the stream when you are finished with it?

Moving to our IO forum...
 
Aravind Iyengar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, that was the error!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!