When I use printLine (or print with the string ending in \n) to a file under Windows 7, I just get a linefeed, not a carriage-return and linefeed.
Is this intended? Is there a property I need to set?
Thanks.
BTW, it would be nice if I could search the website discussions by title only, not the whole post
Fantom doesn't currently support changing of line endings on it's IO streams.
If you need to print a Windows-style newline, print whatever and then print("\r\n") at the end of it. You can even chain these together:
print
print("\r\n")
myLines.each |line| { out.print(line).print("\r\n") }
This might be something to consider adding later. Even if we change it, newlines will continue to haunt programmers for the rest of time ;)
I'm fine with that.
lineend := (Env.cur.os == "win32") ? "\r\n" : "\n" // should this just be "win" now?
turns out jruby 1.4 does the same thing - only outputs linefeeds by default
Login or Signup to reply.
lel4866 Mon 5 Apr 2010
When I use printLine (or print with the string ending in \n) to a file under Windows 7, I just get a linefeed, not a carriage-return and linefeed.
Is this intended? Is there a property I need to set?
Thanks.
BTW, it would be nice if I could search the website discussions by title only, not the whole post
tactics Mon 5 Apr 2010
Fantom doesn't currently support changing of line endings on it's IO streams.
If you need to print a Windows-style newline,
print
whatever and thenprint("\r\n")
at the end of it. You can even chain these together:This might be something to consider adding later. Even if we change it, newlines will continue to haunt programmers for the rest of time ;)
lel4866 Tue 6 Apr 2010
I'm fine with that.
lineend := (Env.cur.os == "win32") ? "\r\n" : "\n" // should this just be "win" now?
turns out jruby 1.4 does the same thing - only outputs linefeeds by default