aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-10-05 09:16:24 -0500
committerMatt Strapp <strap012@umn.edu>2020-10-05 09:16:24 -0500
commitb01b3bb4b46aefa84d29dcaf763dbbc23cecb75e (patch)
tree4d032766d279ef714fd69d613838817ffbbabf15
parentChange filename size (diff)
downloadcsci4061-b01b3bb4b46aefa84d29dcaf763dbbc23cecb75e.tar
csci4061-b01b3bb4b46aefa84d29dcaf763dbbc23cecb75e.tar.gz
csci4061-b01b3bb4b46aefa84d29dcaf763dbbc23cecb75e.tar.bz2
csci4061-b01b3bb4b46aefa84d29dcaf763dbbc23cecb75e.tar.lz
csci4061-b01b3bb4b46aefa84d29dcaf763dbbc23cecb75e.tar.xz
csci4061-b01b3bb4b46aefa84d29dcaf763dbbc23cecb75e.tar.zst
csci4061-b01b3bb4b46aefa84d29dcaf763dbbc23cecb75e.zip
Attempt to fix things and fail
-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[]) {