﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
42	_FileWriteFromArray outputs too many CRLF (File.au3)	mlowery <matin@…>	Gary	"Lines output from the _FileWriteFromArray function in the standard File.au3 include are prefixed by a @CRLF, resulting in an initial blank line in the file. Repeated use of this function and its complement _FileReadToArray on the same file can result in file bloating.

A suggested fix is to change the current file writing loop:

{{{
 	Local $ErrorSav = 0
 	For $x = $i_Base To $i_UBound
 		If FileWrite($hFile, @CRLF & $a_Array[$x]) = 0 Then
			$ErrorSav = 3
			ExitLoop
		EndIf
	Next
}}}

With something such as below that outputs the CRLF after the data, and does not write a final CRLF (code could undoubtedly be improved):

{{{
	Local $ErrorSav = 0
 	For $x = $i_Base To $i_UBound -1
		If FileWriteLine($hFile, $a_Array[$x]) = 0 Then
			$ErrorSav = 3
			ExitLoop
		EndIf
	Next
	If FileWrite($hFile, $a_Array[$i_UBound]) = 0 Then $ErrorSav = 3
}}}

As an additional suggestion, modify the function call to take the array by reference:

{{{_FileWriteFromArray($File, ByRef $a_Array, $i_Base = 0, $i_UBound = 0)}}}

Thanks!"	Bug	closed	3.2.11.0	Standard UDFs	3.2.10.0		Fixed		
