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).]
Just add a line toWrite.flush(); after you do your write().
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Apr 30, 2001
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).]