Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Able to save File but unable to write to file

 
Kim wee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Im having this weird problem where im able to save a new file but im unable to write into the saved file.

care to explain where and what went wrong with my code?

Thanks in advance!
cheers!

 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you know you are unable to write to the file?
 
Kim wee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because the file size is 1KB everytime i save the files and when i open the file its empty.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kim wee wrote:because the file size is 1KB everytime i save the files and when i open the file its empty.

1 kb is not an empty file... try opening it in a text editor. Writing an object information will take that much size only I think.
 
Tim Moores
Bartender
Posts: 2789
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the "file" object that you're writing to the file?
 
Rob Spoor
Sheriff
Pie
Posts: 20526
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And how do you open the file? The file will contain binary contents, not text. That means that a text editor will most likely not be very good at displaying the file. A HEX editor is a better choice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic