Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to output to text file (help)

 
Rick Jones
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've created a list of files froma directory. How can I get that to out put to a text file?

Thanks!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a java.io.FileWriter to open a file. Wrap the FileWriter in a PrintWriter. Then print each name to the file. Then close the file.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic