Page 1 of 3

[Implemented] PrintN() should produce #CRLF$

Posted: Mon Dec 03, 2007 7:12 pm
by horst
Just found out that PrintN() appends a #LF$ only, which is ok for the console window output, but may cause problems when redirectied to a file.

Notepad.exe insists that lines must be terminated with CR+LF. Other editors are a little more flexible, and I don't use Notepad either, but that's why a user of my programs had to tell me about this.

Question: Why doesn't PB add #CRLF$ instead of #LF$, since on the screen there is no difference anyhow?

Posted: Mon Dec 03, 2007 7:56 pm
by Rings
ever think about being crossplattform ?

Posted: Mon Dec 03, 2007 8:09 pm
by horst
Rings wrote:ever think about being crossplattform ?
Can you please exlain what that means for the problem I posted?

Posted: Mon Dec 03, 2007 8:42 pm
by traumatic
horst wrote:
Rings wrote:ever think about being crossplattform ?
Can you please exlain what that means for the problem I posted?
Unix/Linux use LF only, Mac used to use CR only and DOS/Windows use CRLF - I guess that's what Rings meant to say

Posted: Mon Dec 03, 2007 8:42 pm
by Demivec
horst wrote:Can you please exlain what that means for the problem I posted?
I think Rings means that CR+LF is a Windows only solution and wouldn't be considered crossplatform.

Posted: Mon Dec 03, 2007 9:41 pm
by djes
I think there should be an option to change this.

Posted: Mon Dec 03, 2007 10:11 pm
by tinman
Demivec wrote:
horst wrote:Can you please exlain what that means for the problem I posted?
I think Rings means that CR+LF is a Windows only solution and wouldn't be considered crossplatform.
WriteStringN() creates CRLF on Windows, I guess it uses the correct line endings for the other platforms. I don't know why PrintN() should be different from that - use the line ending for the platform it is running on.

Posted: Mon Dec 03, 2007 10:35 pm
by Psychophanta
I would suppress PrintN() and WriteStringN() commands (if i was Fred).
Imo is at the hand of the programmer the eol character/s.

Posted: Mon Dec 03, 2007 10:40 pm
by Trond
Demivec wrote:
horst wrote:Can you please exlain what that means for the problem I posted?
I think Rings means that CR+LF is a Windows only solution and wouldn't be considered crossplatform.
LF is a linux only solution and wouldn't be considered crossplatform either.

Posted: Mon Dec 03, 2007 10:42 pm
by Demivec
Psychophanta has a good point, being that you would just use Print(Text$+EOL$) instead of PrintN(Text$). That way you control what is written instead of the default.

I second what djes said also, there should be an option to change this.

Posted: Tue Dec 04, 2007 9:18 am
by horst
@tinman:
> WriteStringN() creates CRLF on Windows, I guess it uses the correct line endings for the other platforms. I don't know why PrintN() should be different from that - use the line ending for the platform it is running on.

Thank you, that's the point.

@Psychophanta, Demivec:
I think it is not very realistic to ask for suppression of PrintN() and WriteStringN().
And as long as these commands exist, they should append the platform dependent EOL code.

@djes, Demivec:
I don't think, there should be an extra option (i.e. optional parameter). You can always code Print(text$ + #whatever$).

Posted: Tue Dec 04, 2007 1:18 pm
by freak
I changed it to CRLF for windows.

Posted: Tue Dec 04, 2007 1:49 pm
by Rings
...... i like such threads, i put a small sentence in it and it
solve itselfs


have you tried turn it off and on ???

Posted: Tue Dec 04, 2007 1:51 pm
by Dare
:lol:

Posted: Wed Dec 05, 2007 3:38 pm
by naw
Trond wrote:
Demivec wrote:
horst wrote:Can you please exlain what that means for the problem I posted?
I think Rings means that CR+LF is a Windows only solution and wouldn't be considered crossplatform.
LF is a linux only solution and wouldn't be considered crossplatform either.
Actually <LF> is a Linux and Unix and BSD (which therefore presumably includes OSX) - so IMO <LF> is the standard and <CRLF> (Windows) or <CR> MacOS are the non-standard exceptions.

It seems to me that Windows uses <CR> & <LF> to end a line, so while that is inefficient it should be readable all major OS's (Unix & Linux & OSX & Win)