• Post Reply Bookmark Topic Watch Topic
  • New Topic

Storing array values to a text file

 
parvathi k
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class with three String type arrays storing values like ,name,address,telno:. I want to store this data in a text file like a table with three columns(or if not possible in three saparate text files).I will be thankful if any body can give me the code part for that or clue for the answer.
 
moazzam rasheed
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// Creates a new output file with the path and file name specified
File output = new File(strOutDirPath , strOutFileName);
// creates a writer object with file writer to write on the file
BufferedWriter out = new BufferedWriter(new FileWriter(output.getPath() , true));
if(!output.isFile()){
System.out.println("Creating "+output.getPath() +" failed");
return;
}
out.write("string u want to write");
out.close();
for spaces put spaces in writing and for next line
just place fileobject.newLine();
read from ur array nd format yr application as desired need any more help please feel free to contact me
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!