Dear All,

How to read a csv file in c?
Thank you in advance.

Two ways come to mind:

1) use fscanf(). It naturally breaks with spaces, so if your record fields have just a single word in them, followed by a comma and a space before the next field, it's good. The comma will have to be removed from the last char of the word, however. (easy enough).

2) use strtok(). Set the delimiter to ',' and '\n'. Works on multi word fields, where #1 would not work as easily. Requires the include file string.h be in the header file list.

Post up some code to get started, if you need some help.