aboutsummaryrefslogtreecommitdiff
path: root/CST 126/Homework 2/Homework2/program.cpp
diff options
context:
space:
mode:
authorChanin Timbal <[email protected]>2024-04-27 14:05:17 -0700
committerChanin Timbal <[email protected]>2024-04-27 14:05:17 -0700
commitf94af69b62058b241e569b973a136afb4d331d46 (patch)
tree6333c9062e329593e5d7cae8a1c94bc46391a426 /CST 126/Homework 2/Homework2/program.cpp
parentCompleted Program of Currency Conversion (diff)
downloadhomework-1-chaninnohea-f94af69b62058b241e569b973a136afb4d331d46.tar.xz
homework-1-chaninnohea-f94af69b62058b241e569b973a136afb4d331d46.zip
Homework 2 first commit
Diffstat (limited to 'CST 126/Homework 2/Homework2/program.cpp')
-rw-r--r--CST 126/Homework 2/Homework2/program.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/CST 126/Homework 2/Homework2/program.cpp b/CST 126/Homework 2/Homework2/program.cpp
new file mode 100644
index 0000000..158a2be
--- /dev/null
+++ b/CST 126/Homework 2/Homework2/program.cpp
@@ -0,0 +1,70 @@
+//Chanin Timbal
+//Homework 2
+//27 April 2024
+
+#include <iostream>
+
+#include "helpers.hpp"
+#include "Base64Converter.hpp"
+
+constexpr short ARG_COUNT = 4;
+
+bool Worker();
+bool Worker(char** argv);
+
+
+
+int main(const int argc, char* argv[])
+{
+ if (argc == ARG_COUNT)
+ {
+ //run the command line version
+ Worker(argv);
+ }
+ return Worker();
+}
+
+bool Worker()
+{
+}
+
+bool Worker(char** argv)
+{
+ const char* arg1 = argv[1]; //-e -d
+ const char* arg2 = argv[2]; //source file name
+ const char* arg3 = argv[3]; //destination file name
+
+ const char option = arg1[1]; //e or d
+
+ switch (option)
+ {
+ case 'e':
+ //file reading binary
+ char* buffer = new char[1];
+
+ buffer = ReadFileAsBinary(arg2, buffer);
+ //endcoding work
+
+ bool success = WriteTextToFile(arg3, buffer);
+
+ delete[] buffer;
+
+ return success;
+ case 'd':
+ //file reading text
+ //decoding work
+ //file writing binary
+ return true;
+ default:
+ std::cerr << "Invalid command option\n" <<
+ "Valid commands:\n" <<
+ "\t-e source_file.exe destination_file.exe" <<
+ "\t\tEncodes file in source into text in destination txt file." <<
+ "\t-d source_file.txt destination file.exe" <<
+ "\t\tDecodes text in source file into the destination file.\n\n";
+ return false;
+ }
+
+
+ return false;
+} \ No newline at end of file