cs240/hw/hw12Old/miniDB.h

30 lines
1002 B
C
Raw Normal View History

2018-10-15 17:20:57 -04:00
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fnmatch.h> // This is used for wildcard matching.
#define FNM_CASEFOLD (1 << 4)
typedef struct Movie {
// All strings are no greater than 512 characters.
char* title;
char* date;
char* director;
int id;
struct Movie* next;
} Movie;
int load(char* filename); // Load file into data structure.
int save(char* filename); // Save datastructure to file.
int read(char* filename, char* fileOut); // Read commands and execute appropriately.
Movie* get(int id);
int idIncluded(int id, int* idList, size_t len); // Checks if id is included in idList.
void trimString(char* str); // Removes trailing spaces from string.
int add(char* title, char* date, char* director, int id);
int edit(int id, char* feature, char* data);
int removeId(int id); // Had to name it differently because of function in stdio.
int lookup(char* feature, char* data, FILE* out);
int display(char* feature, int order, int max, FILE* out);