summaryrefslogtreecommitdiff
path: root/34_put_together/main.c~
diff options
context:
space:
mode:
Diffstat (limited to '34_put_together/main.c~')
-rw-r--r--34_put_together/main.c~49
1 files changed, 49 insertions, 0 deletions
diff --git a/34_put_together/main.c~ b/34_put_together/main.c~
new file mode 100644
index 0000000..4a3ac74
--- /dev/null
+++ b/34_put_together/main.c~
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#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;
+}