/* libcsvparer.c - csv parsing library This file is part of libcsvparser. libcsvparser is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. libcsvparser is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with mp3fw. If not, see . */ #include #include #include #include "csvparser.h" #define MAXCHAR 1000 int lcsv_list_all(char *file) { int return_value; FILE *fp; char row[MAXCHAR]; char *token; fp = fopen(file, "r"); if (fp == NULL) { return_value = 1; return return_value; } while (feof(fp) != true) { fgets(row, MAXCHAR, fp); token = strtok(row, ","); while (token != NULL) { printf("%s\n", token); token = strtok(NULL, ","); } } return_value = 0; return return_value; }