Hello Sir,
Is it possible to insert the new line character in set of String variables and stored them into bytearray ,then finally write into File?
This is the sample code which i tried:
File f = new File(messagesDir,"msg" + msgnum + ".txt");
FileOutputStream fout = new FileOutputStream(f);
String fromString = "From: "+msg.getFrom()+"\n";
String toString = "To: "+msg.getTo()+"\n";
String dateString = "Sent: "+msg.getDate()+"\n";
String msgString =msg.getBody()+"\n";
String finalString=fromString+toString+dateString+msgString;
byte[] msgBytes = finalString.getBytes();
fout.write(msgBytes);
fout.close();
in the above code , i tried to add the new line as "\n" in end of each string. but when i look into the generated files msg1.txt , it contains some junk char [] .
please provide me the help
regards
venki