diff --git a/src/csv.c b/src/csv.c index 8b4f52c..9733fc7 100644 --- a/src/csv.c +++ b/src/csv.c @@ -76,6 +76,7 @@ void write_to_file(book_t* book) file_exists = access(FILE_NAME, F_OK); if (0 != file_exists) { file = fopen(FILE_NAME, "w"); + // write the csv headers to the file since we're making it fprintf(file, "id,isbn,title,authors,imageurl,year of publication,page length\n"); book_id = 1; } else { diff --git a/src/csv.h b/src/csv.h index 2ae5a43..4bbf1d3 100644 --- a/src/csv.h +++ b/src/csv.h @@ -3,10 +3,27 @@ #define FILE_NAME "books.csv" +/** + * int get_next_id + * + * Returns the next available ID so that we know what to assign to the book + */ int get_next_id(); +/** + * void write_to_file + * boot_t* book - A pointer to the book information struct + * + * Writes the book information to a CSV file + */ void write_to_file(book_t* book); +/** + * long find_id + * int id_to_find - The ID we're looking for + * + * Returns the position of a FILE to the line with the ID we're looking for + */ long find_id(int id_to_find); #endif