File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why does this not work? >:(

 
Eric Johnson
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am a newbie tryin to learn the language. i am messing with writing files and can't get it to work. here is what i tried, not knowing what i was doing but looking over the api and trying to go from there:

it creates a text file, but without any contents. ok, so before i get too frustrated with this i decide to look in the book from my class, and try the code there. it doesn't work either. it creates an empty file also.
this is from sun's java programming language class sl-275:

why can i not write a file that actually contains something? please help, i am becoming disillusioned.
(edited by Cindy to format code)
[This message has been edited by Cindy Glass (edited September 07, 2001).]
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just add a line
toWrite.flush();
after you do your write().
 
Eric Johnson
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THANK YOU! that's what i get for ignoring methods i don't think i will have to bother with.
i imagine adding toWrite.close() will do the trick also. i'm not sure what the difference is, but i will research it. thanx again, i don't feel so dumb now. oh, and thanx for formatting the code. i will try and do that in the future.
[This message has been edited by Eric Johnson (edited September 07, 2001).]
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic