aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.vscode/c_cpp_properties.json2
-rw-r--r--P1/src/mapper.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
index 6e1b9ed..f9a909e 100644
--- a/.vscode/c_cpp_properties.json
+++ b/.vscode/c_cpp_properties.json
@@ -3,7 +3,7 @@
{
"name": "Linux",
"includePath": [
- "${workspaceFolder}/**"
+ "${workspaceFolder}/P1/include"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
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[]) {