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.

Eg.
Code:
while(fgets(buf,sizeof(buf),fp)!=NULL) {
  parseLine(buff,fields); // assign each CSV to the fields array
  processFields(fields);
}
Then replace strtok() with http://www.hmug.org/man/3/strsep.php if you have such a function.