How to append a new line to a File/FileConduit?

Sam Hu samhu.samhu at gmail.com
Mon Jan 12 22:42:28 PST 2009


Hello everyone!

Just found I can not append a new line to a file when writing data to a File or FileConduit instance.

File file=new File("myfile.txt");
myfile.append("This is line 1");
myfile.append("This is line 2");
About code just generate "This is line 1This is line 2"
I tried below code but all the same:
myfile.append("\n\nThis is line 1\n\n");
myfile.append("\n");
myfile.append("This is line 2");

Can anybody help my on how to make it ?I just want to write data into a file line by line:
This is line 1
This is line 2

Thanks.

Sam


More information about the Digitalmars-d-learn mailing list