Hi all,
I am working on a program which will generate a log file for it's operation. Because of the way the program is designed, the program maintains a String variable for all the log that needs to be written and write that string into the file at it's exit. The log message contains a string that contains a lots of new line character. The write operation succeeds without any error.
However, when I opens the log file in the "notepad", then all the message appears in a single line with the newlines replaced with a rectangle. However, the log can be viewed properly in the "wordpad". So can anybody please tell me that whether this is a notepad problem or there is some error in the way I am writing the data in the log file?
I am writing the log using the following idea:
import java.io.*;
import java.util.*;
class test
{
public static void main(String[] args)
{
try {
BufferedWriter out = new BufferedWriter(new FileWriter("test.txt"));
out.write("aString\nthis is a\nttest");
out.close();
}
catch (IOException e)
{
System.out.println("Exception ");
}
return ;
} // main ends here.
}; // the class ends here.