WriteStringN() extra parameter
Posted: Sat Aug 31, 2019 9:29 pm
We need an extra parameter to specify line ending type - CR, LF and CRLF
http://www.purebasic.com
https://www.purebasic.fr/english/
Dude has already written in this topic why this wish is unnecessary.Sicro wrote:Related: WriteString(): Add flag to set the line ending char
It is not unnecessary to propose alternative solutions, just because there is already a solution. Perhaps there are better, clearer solutions than the built-in solution.Josh wrote:Dude has already written in this topic why this wish is unnecessary.
Such a command / flag would be good, too.Josh wrote:It would make more sense to have a command that writes a string with a terminating 'Null' character.
E.g. WriteStringT for 'Write String Terminated'.
Code: Select all
WriteString(File, Text$ + #CRLF$)
; or
WriteString(File, Text$, #PB_File_CRLF)
WriteStringN(File, Text$)
; or
WriteString(File, Text$, #PB_File_SystemEOL)
Code: Select all
Macro WriteStringCRLF(File, Text, Format = #Null)
WriteString((File), Text + #CRLF$, (Format))
EndMacro
Macro WriteStringLF(File, Text, Format = #Null)
WriteString((File), Text + #LF$, (Format))
EndMacro
After further considerations, I then revised my first post in my thread. My thought was: Why is another function WriteStringN() necessary, which differs only very slightly from the function WriteString(). Isn't it enough to just add another flag to WriteString()? Besides the existing constants there has to be another constant #PB_File_SystemEOL or #SystemEOL and the function WriteStringN() is no longer needed.PB help wrote:To write a string including a newline sequence, use the WriteStringN() function.
It's just a quick one-minute search/replace with any given tool to fix that for all sources in a folder. Not a serious problem at all.Sicro wrote:But the removal of a programming language command that exists since a long time is very serious, because many existing codes do not work anymore due to such a change.