Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

write problem in text file  RSS feed

 
Thakur Sachin Singh
Ranch Hand
Posts: 248
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone!!

i have completed one project on segmentation. when i click on a button to write the data in a text file then there are no write operation perform on the file...after writing file is blank...can anyone tell me why this happen to me.
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you flushing and closing the stream / writer?
 
Thakur Sachin Singh
Ranch Hand
Posts: 248
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is code of my recontruct button...i write my segment data in a file from this button.
 
Thakur Sachin Singh
Ranch Hand
Posts: 248
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but problem is...when i write the data in this file then no data write to this file.
 
Sergey Babkin
author
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thakur Sachin Singh wrote:but problem is...when i write the data in this file then no data write to this file.


You close them in the backwards order. You need to close dos first, fos last. The way it's now, first you close the file then you close the intermediate filters, telling them to flush the data. They try to flush but the file is already closed, so they have nowhere to write to.
 
Thakur Sachin Singh
Ranch Hand
Posts: 248
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but problem is same if i change the order like this.



what you want to say about filters and flush.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!