ArrayFilePutCsv

Writes a two-dimension array to a file.

Syntax:

ArrayFilePutCsv (filename, array [, delimiter [, write-undef [, flags]])

Parameters:

(s) filename: path and file name of the file to create.

(a) array: specifies an array.

(s) delimiter: [optional] specifies the character used to separate values on each line of the file. It can be any single printable character, numbered from 32 to 126 (decimal), except a space(32) or double quotation mark(34). If omitted, a comma will be used as the delimiter.

(i) write-undef: [optional] see below.

(i) flags: [optional] see below.

Returns:

(i)  Returns the number of bytes written to the file.

 

If "write-undef" is @TRUE, then uninitialized elements in the array will be written as blank values in the file. If "write-undef" is @FALSE, then uninitialized elements will not be written.

"flags" can be set to 0, or can specify one or more of the following values combined with the bitwise OR ('|') operator:

Value

Meaning

2

Do not do CSV file double quote type processing. This should only be used in cases where you are sure the 'delimiter' will be found nowhere in the data.

 

By default, each line in the file will be terminated with a CR/LF. This can be changed using IntControl 53.

Line break handling within CSV files
WinBatch will not handle a line break within a field. WinBatch considers a line feed to be the end of a line. In this case, the layout of the CSV file will be disrupted or broken.

 

Example:

outputfile = "c:\temp\output.csv"
array = ArrDimension(10,10)
For x = 0 To 9
   For y = 0 To 9
      array[x,y] = x*y
   Next
Next
ArrayFilePutCSV(outputfile, array, ",",@TRUE,0)
Message("Done","Two-dimension array written to file")

See Also:

IntControl 40, IntControl 53, Arrays, ArrayFileGet, ArrayFileGetCsv, ArrayFilePut, ArrayFilePutCsv, ArrayFromStr, ArrayInsertArrayItemize,  Arrayize, ArrayLocate, ArrayRedim, ArrayRemove, ArrayReverse, ArraySort, ArraySwapElements, ArrayToStr, ArrDimension, ArrInfo, ArrInitalize, Drop