Either 'i' needs to be initialized with the column count (if the data are to go into separate columns)
Those were my assumptions.