Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Convert Linefeeds (LF) to Carriage Return Linefeeds (CRLF)

Keywords: Fileread CRLF LF Carriage return line feed

The example code has not been debugged, first make a backup copy of your original file.

The basic idea here is that you load the file into a binary buffer, and then replace all the LFs with CRLFs.

   
;Replace LF with CR/LF  (DOSize the file)
fn = "C:\temp\unix.txt"
fs = FileSize(fn)
bb = BinaryAlloc(fs*2)
BinaryRead(bb,fn)
BinaryReplace(bb,@LF,@CRLF,@True)
BinaryWrite(bb,fn)
BinaryFree(bb)
Message("All","Done")

Article ID:   W13075
Filename:   FileRead on Files with LF Endings.txt