View mode: basic / threaded / horizontal-split · Log in · Help
December 05, 2005
operating-system-specific line ending
how to know what is the operating-system-specific line ending ?

std.stream has following code:
----------------------
void writeLine(char[] s) {
writeString(s);
version (Win32)
writeString("\r\n");
else version (Mac)
writeString("\r");
else
writeString("\n");
}
----------------------


how about making it
----------------------

version (Win32)
conts _D_NL = "\r\n"; 
else version (Mac)
conts _D_NL = "\r";
else
conts _D_NL = "\n";

void writeLine(char[] s) {
writeString(s);
writeString(_D_NL);
}
----------------------

so that we can use the constant _D_NL directly in our programs. 

May be such a constant is already defined somewhere, if so, could somebody
please point it to me ?

thanks in advance
-SAI
December 05, 2005
Re: operating-system-specific line ending
On Mon, 05 Dec 2005 18:07:20 -0500, sai <sai_member@pathlink.com> wrote:

> how to know what is the operating-system-specific line ending ?

std.path.linesep  Why it's there, I don't know.
Top | Discussion index | About this forum | D home