Hi,
i'm importing fields from a csv file like this:
Robert White,Naples,0001
Eric Red,Washington,0002
Peter Green,Paris,0003
I can't understand why I need to put a carriage return on the first line to have all three rows imported.
And I can't understand why it also reads an "extra row" filled with zeros in the end.
So my output is basically:
Robert White,Naples,0001
Eric Red,Washington,0002
Peter Green,Paris,0003
0,0,0
Is there a particular behaviour for this object? Documentation from Microsoft is quite poor about it...
This is my code:
static void CommaIO(Args _args)
{
FileName fileName = 'C:\\Users\\note98\\Desktop\\testdata.csv';
CommaIo csvFile;
container readCon;
str column1,column2,column3;
;
csvFile = new CommaIo(filename, 'r');
csvFile.inFieldDelimiter(','); // Delimiter...
if (csvFile)
{
readCon = csvFile.read();
while (csvFile.status() == IO_Status::OK)
{
readCon = csvFile.read();
column1 = conPeek(readCon, 1);
column2 = conPeek(readCon, 2);
column3 = conPeek(readCon, 3);
info(strFmt("%1 - %2 - %3", column1, column2, column3));
}
}
}
*This post is locked for comments