Skip to content

Latest commit

 

History

History
76 lines (50 loc) · 1.86 KB

File metadata and controls

76 lines (50 loc) · 1.86 KB

CS50 Final Project - Nuggets

Group jjen: Julian, Joanna, Eddie, Neo

libs

The libs library contains several modules from libcs50 that were used in our implementation of Nuggets:

  • file - functions to read files (includes readLine)
  • memory - handy wrappers for malloc/free

Usage

Both the modules included in libs are used in our implementation of the Nuggets game

file

file provides file utilities (reading a word, line, or file) and exports the following functions:

int file_numLines(FILE* fp);
static int never(int c);
static int isnewline(int c);
char* file_readFile(FILE* fp);
char* file_readLine(FILE* fp);
char* file_readWord(FILE* fp);
char* file_readUntil(FILE* fp, int (*stopfunc)(int c));
int main(int argc, char* argv[]);

memory

memory provides wrappers for malloc/free and exports the following functions:

void* mem_assert(void* ptr, const char* message);
const void* mem_assert_const(const void* ptr, const char* message);
void* mem_malloc_assert(const size_t size, const char* message);
void* mem_malloc(const size_t size);
void* mem_calloc_assert(const size_t nmemb, const size_t size, const char* message);
void* mem_calloc(const size_t nmemb, const size_t size);
void mem_free(void* ptr);
void mem_report(FILE* fp, const char* message);
int mem_net(void);

Implementation

file

See file.h for more details regarding the implementation of the functions in this module.

memory

See mem.h for more details regarding the implementation of the functions in this module.

Files

  • Makefile - compilation procedure

file

  • file.h - the interface
  • file.c - the implementation

memory

  • mem.h - the interface
  • mem.c - the implementation

Compilation

To compile, simply make.

Testing

We did not unit test these modules as they were provided by the libcs50 library.