aboutsummaryrefslogtreecommitdiffstats
path: root/P1
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-10-05 22:11:10 -0500
committerMatt Strapp <strap012@umn.edu>2020-10-05 22:11:10 -0500
commit209af5235c9595b18b4ec41b5b317a8a35dfc116 (patch)
treedfdd633fb7a794a4a5d4ba474b3e173fa8d31594 /P1
parentMerge branch 'master' of github.umn.edu:STRAP012/csci4061Projects (diff)
downloadcsci4061-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 'P1')
-rw-r--r--P1/src/reducer.c6
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;
}