Append a sting to a file:
public static void FileAppend(String FileName, String Text)
{
/*
* (c) John Minkjan
* 101Java.blogspot.com
* 2011 till 2031
*/
try {
// Create file if not exists else append
FileWriter fstream = new FileWriter(FileName, true);
BufferedWriter out = new BufferedWriter(fstream);
out.write(Text);
// add an extra CR;
out.append("\r");
//Close the output stream
out.close();
} catch (Exception e) { //Catch exception if any
System.err.println("Error: " + e.getMessage());
}
};
Till Next Time
No comments:
Post a Comment