Line gaps with text files

Joel joelcnz at gmail.com
Sat Feb 9 18:37:38 PST 2013


This works better:

import std.stdio;
import std.file;

void main() {
	//string s = readText("s.txt");

	string s;
	foreach(line; File("s.txt", "r").byLine()) {
		s ~= line~"\r\n";
	}
	s = s[0..$-2];

	writeln([s]);
	
	File("s.txt", "w").write(s);
}

But one text file program says it has solitary carriage returns 
in it.


More information about the Digitalmars-d-learn mailing list