diff options
author | Matt Strapp <strap012@umn.edu> | 2020-11-03 09:10:32 -0600 |
---|---|---|
committer | Matt Strapp <strap012@umn.edu> | 2020-11-03 09:10:32 -0600 |
commit | 5efc3cf5e150b5b0e3cfc880290607938af67be3 (patch) | |
tree | accdc6f23ce84b19f3265bc9ff35ca9225c168fc /P2 | |
parent | Fix starting at 2 instead of 1 (diff) | |
download | csci4061-5efc3cf5e150b5b0e3cfc880290607938af67be3.tar csci4061-5efc3cf5e150b5b0e3cfc880290607938af67be3.tar.gz csci4061-5efc3cf5e150b5b0e3cfc880290607938af67be3.tar.bz2 csci4061-5efc3cf5e150b5b0e3cfc880290607938af67be3.tar.lz csci4061-5efc3cf5e150b5b0e3cfc880290607938af67be3.tar.xz csci4061-5efc3cf5e150b5b0e3cfc880290607938af67be3.tar.zst csci4061-5efc3cf5e150b5b0e3cfc880290607938af67be3.zip |
Start on dir traversal
Diffstat (limited to '')
-rw-r--r-- | P2/lib/utils.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c index ab38470..22ebfae 100644 --- a/P2/lib/utils.c +++ b/P2/lib/utils.c @@ -91,12 +91,19 @@ int getInterData(char *Qkey, int reducerID) { void shuffle(int nMappers, int nReducers) { struct msgBuffer message = makeMessage(); //Once again, MAKE SURE THIS WORKS PROPERLY! + char path[100]; + getcwd(path, 100); int id = openQueue("reduce"); for (int i = 1; i <= nMappers; i++) { - //Extra for loop traversing directory - //TODO: Actually traverse directory + char newpath[100]; + sprintf(newpath, "%s/output/MapOut/Map_%d", path, i); + printf("%s\n", newpath); + DIR *dir = opendir(newpath); + struct dirent* entry; + while ((entry = readdir(dir)) != NULL) { //message.msgType = hashFunction(/* SOMETHING ,*/ nReducers); msgsnd(id, &message, chunkSize, 0); + } } } |