diff options
author | Matt Strapp <strap012@umn.edu> | 2020-10-05 22:11:10 -0500 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-10-05 22:11:10 -0500 |
commit | 209af5235c9595b18b4ec41b5b317a8a35dfc116 (patch) | |
tree | dfdd633fb7a794a4a5d4ba474b3e173fa8d31594 | |
parent | Merge branch 'master' of github.umn.edu:STRAP012/csci4061Projects (diff) | |
download | csci4061-209af5235c9595b18b4ec41b5b317a8a35dfc116.tar csci4061-209af5235c9595b18b4ec41b5b317a8a35dfc116.tar.gz csci4061-209af5235c9595b18b4ec41b5b317a8a35dfc116.tar.bz2 csci4061-209af5235c9595b18b4ec41b5b317a8a35dfc116.tar.lz csci4061-209af5235c9595b18b4ec41b5b317a8a35dfc116.tar.xz csci4061-209af5235c9595b18b4ec41b5b317a8a35dfc116.tar.zst csci4061-209af5235c9595b18b4ec41b5b317a8a35dfc116.zip |
Maybe #6 is done?
Diffstat (limited to '')
-rw-r--r-- | P1/src/reducer.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/P1/src/reducer.c b/P1/src/reducer.c index ad29f6f..7c5e8f2 100644 --- a/P1/src/reducer.c +++ b/P1/src/reducer.c @@ -58,7 +58,7 @@ void reduce(char *key) { int count = 0; while(parsedKey != NULL) { - count++; + count += atoi(parsedKey); parsedKey = strtok(NULL, " "); } @@ -77,8 +77,8 @@ void writeFinalDS(int reducerID){ // Shove word and number of occurances in a file named word.txt char filename[BUFFSIZE] = ""; sprintf(filename, "output/ReduceOut/Reduce_%d.txt", reducerID); - FILE* fptr = fopen(filename, "w"); - fprintf(fptr, "%s %d", tempNode -> key, tempNode -> value); + FILE* fptr = fopen(filename, "a"); + fprintf(fptr, "%s %d\n", tempNode -> key, tempNode -> value); fclose(fptr); tempNode = tempNode -> next; } |