adds CSV documentation
This commit is contained in:
parent
4d3dfee74c
commit
ebebe13f0e
@ -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 {
|
||||
|
17
src/csv.h
17
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user