#include #include #include #include "kv.h" #include "counts.h" #include "outname.h" counts_t * countFile(const char * filename, kvarray_t * kvPairs) { FILE *f = fopen(filename, "r"); if (f == NULL) { fprintf(stderr, "Could not open file!\n"); return NULL; } counts_t * c = createCounts(); if (fclose(f) != 0) { fprintf(stderr, "Could not close file!\n"); return NULL; } return c; } int main(int argc, char ** argv) { //WRITE ME (plus add appropriate error checking!) //read the key/value pairs from the file named by argv[1] (call the result kv) //count from 2 to argc (call the number you count i) //count the values that appear in the file named by argv[i], using kv as the key/value pair // (call this result c) //compute the output file name from argv[i] (call this outName) //open the file named by outName (call that f) //print the counts from c into the FILE f //close f //free the memory for outName and c //free the memory for kv return EXIT_SUCCESS; }