File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes My FileOutputStream is not writing data to a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "My FileOutputStream is not writing data to a file" Watch "My FileOutputStream is not writing data to a file" New topic
Author

My FileOutputStream is not writing data to a file

Nate Benton
Greenhorn

Joined: May 19, 2014
Posts: 5
My program creates a file but cannot write to it and i cannot figure out why.
How can i fix this code so that the FileOutputStream writes the String "Output" to the file HighScore.


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

Change



to



Your code writes to a file named "ScoreFile".

By the way lines 8-13 of your posted code are unnecessary, FileOutputStream does those things automatically.
Nate Benton
Greenhorn

Joined: May 19, 2014
Posts: 5
thank you very much, I did not know that it did that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My FileOutputStream is not writing data to a file