Results 1 to 4 of 4
Thread: Please help me out here
- 07-13-2007, 07:50 PM #1
Member
- Join Date
- Jun 2007
- Posts
- 13
- Rep Power
- 0
Please help me out here
consider the following program segment..
FileWriter f=new FileWriter(args[0]);
............
..........
f.write('\n');
The above given segment is from one of my programs.whenever I use f.write('\n') to go to a new line in the output file,the function is printing a small square box in the file.But,I want it to move the control to a new line so that whatever character it writes in the file thereafter writes it in a new line.This is happening for all the escape sequences used.Can anybody give me a solution for this problem?Reply soon.Thanq....
- 07-13-2007, 08:52 PM #2
"\n" is not a platform independent way of writing a new line to a file. Try using:
Here are some relevant javadocs:Java Code:f.write(System.getProperty("line.separator"));
BufferedWriter.html#newLine()
System.html#getProperties()
- 07-14-2007, 11:55 AM #3
Member
- Join Date
- Jun 2007
- Posts
- 13
- Rep Power
- 0
Thanks for the reply.What about using other escape sequences like '\b'(Whitespace)?
- 07-14-2007, 12:10 PM #4


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks