From b01b3bb4b46aefa84d29dcaf763dbbc23cecb75e Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 5 Oct 2020 09:16:24 -0500 Subject: Attempt to fix things and fail --- P1/src/mapper.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'P1/src/mapper.c') diff --git a/P1/src/mapper.c b/P1/src/mapper.c index a729060..3350288 100644 --- a/P1/src/mapper.c +++ b/P1/src/mapper.c @@ -99,8 +99,10 @@ void map(char *chunkData){ // Each file will have only one line : word 1 1 1 1 1 ... // poops the data out into separate .txt files named after the word void writeIntermediateDS() { - intermediateDS *tempNode = &DS; - valueList *tempNode2 = tempNode -> value; + + intermediateDS *root = &DS; + intermediateDS *tempNode = root; + valueList *tempNode2 = root -> value; while(tempNode != NULL) { // Get string of 1's associated with the word @@ -111,16 +113,15 @@ void writeIntermediateDS() { strcat(ones, "1 "); tempNode2 = tempNode2 -> next; } - // Shove word and ones in a file named word.txt - char filename[50]; + char filename[150]; sprintf(filename, "output/MapOut/Map_%d/%s.txt", mapperID, tempNode -> key); FILE* fptr = fopen(filename, "w"); fprintf(fptr, "%s %s", tempNode -> key, ones); fclose(fptr); tempNode = tempNode -> next; } - // freeInterDS(&DS); + freeInterDS(root); } int main(int argc, char *argv[]) { -- cgit v1.2.3