MBS Xojo Developer Conference and Training
Join us from 3rd to 6th May 2017 in Berlin, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to convert line endings in text files?
Feedback.

Answer: You can simply read file with TextInputStream and write with new line endings using TextOutputStream class.
Example:
dim inputfile as FolderItem = SpecialFolder.Desktop.Child("test.txt")
dim outputfile as FolderItem = SpecialFolder.Desktop.Child("output.txt")
dim it as TextInputStream = TextInputStream.Open(inputfile)
dim ot as TextOutputStream = TextOutputStream.Create(outputfile)

ot.Delimiter = EndOfLine.Windows // new line ending
while not it.EOF
ot.WriteLine it.ReadLine
wend
Notes: TextInputStream will read any input line endings and with delimiter property in TextOutputStream you can easily define your new delimiter.




Links
MBS Realbasic tutorial videos