• Post Reply Bookmark Topic Watch Topic
  • New Topic

write .txt file

 
Sham Jowsaki
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have an string like "one,two,three, four,five,six".
and am sending different strings like above one by one.
I wanna write each word in separate line and save it as .txt file.
the text file has to be
one
two
three
four
five
six
2nd string
seven
eight
nine
.
..

Please help me out.
Thanks
Jowsaki
[ February 06, 2003: Message edited by: Sham Jowsaki ]
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sham,
All you need is a BufferedWriter and a StringTokenizer and you're in business.
Try this:

After you compile and run this, just open up the file out.txt in the same directory and see if it meets your criteria.
Hope this helps,
Michael Morris
[ February 06, 2003: Message edited by: Michael Morris ]
 
Sham Jowsaki
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Morris:
Hi Sham,
All you need is a BufferedWriter and a StringTokenizer and you're in business.
Try this:

After you compile and run this, just open up the file out.txt in the same directory and see if it meets your criteria.
Hope this helps,
Michael Morris
[ February 06, 2003: Message edited by: Michael Morris ]


Thanks Michael. It is working fine.
Jowsaki
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!