Reads a file containing comma separated values, and returns the file content as a list. The file may have an optional .csv suffix.
The result list contains one element for each record/row in the file. By default, each list element is itself a list, containing the row's field values. Alternatively, the type-option can be used to return structures instead of lists.
The data elements are strings, unless they can be interpreted as numbers (by ECLiPSe's number_string/2 predicate) and the 'convert' option is true (the default).
Options are:
% Given file data.csv containing the line:
% a, b, 123, c d," e f "
?- csv_read("data.csv", Rows, []).
Rows = [["a", " b", 123, " c d", " e f "]]
?- csv_read("data.csv", Rows, [strip:true, convert:false]).
Rows = [["a", "b", "123", "c d", " e f "]]
?- csv_read("data.csv", Rows, [strip:true, type:row/N]).
Rows = [row("a", "b", 123, "c d", " e f ")]
N = 5