• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

why does this not work? >:(

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just add a line
toWrite.flush();
after you do your write().
 
Eric Johnson
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic