From 334fd25273d5a45f4e8254e65e18b2124dae94d5 Mon Sep 17 00:00:00 2001 From: Matthew Strapp Date: Mon, 12 Oct 2020 08:16:48 -0500 Subject: add new breakout --- csci4061/101220_breakout/exercise.c | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 csci4061/101220_breakout/exercise.c (limited to 'csci4061/101220_breakout/exercise.c') diff --git a/csci4061/101220_breakout/exercise.c b/csci4061/101220_breakout/exercise.c new file mode 100644 index 0000000..5021142 --- /dev/null +++ b/csci4061/101220_breakout/exercise.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int numOfEntries(char* path) { + /* + Count the number of entries in path + */ +} + +int main(int argc, char** argv){ + if (argc < 2) { + printf("Pass the path as an argument to the program"); + exit(1); + } + char* path = argv[1]; + + DIR* dir = opendir(path); + if(dir==NULL){ + printf("The path passed is invalid"); + return -1; + } + struct dirent* entry; + + /* + Iterate through the elements in argv[1] + Refer the ls example in slides if you have any doubts + */ + + closedir(dir); + return 0; +} \ No newline at end of file -- cgit v1.2.3