My first suggestion would be to add some functions to separate some of the actions out from main.
This will reduce clutter, and make testing individual parts much easier.
parseLine(buff,fields); // assign each CSV to the fields array
Then replace strtok() with http://www.hmug.org/man/3/strsep.php
if you have such a function.