03-25-2015, 07:45 PM
Macro Macro2534
Or you can add rows directly to array a. Then don't need two arrays.
Macro Macro2535
ARRAY(str) a b
str sFile="$temp$\a.txt"
;load an existing file and show the row count
if(FileExists(sFile)) ArrayFromCsvFile_str2d a sFile
out a.len
;append new row and save
b="qwe[]rty[]uio" ;;create array with 3 elements. You can instead use any other way to create array, for example: b.create(3); b[0]="qwe"; b[1]="rty"; b[2]="uio"
ArrayToCsvFile_str2d2 a sFile b
;show results
run sFile
;run this macro several times to see how it worksOr you can add rows directly to array a. Then don't need two arrays.
Macro Macro2535
ARRAY(str) a
str sFile="$temp$\a2.txt"
;load an existing file and show the row count
if(FileExists(sFile)) ArrayFromCsvFile_str2d a sFile
out a.len
;append new row and save
int i=a.len
if(i) a.redim(i+1) ;;add one row
else a.create(3 1) ;;create array with 3 columns and 1 row
a[0 i]="qwe"; a[1 i]="rty"; a[2 i]="uio"
ArrayToCsvFile_str2d a sFile
;show results
run sFile
;run this macro several times to see how it works