aboutsummaryrefslogtreecommitdiff
path: root/CST 126/Homework 2/Homework2/program.cpp
blob: 158a2be9b801a613a9c269cd9e69457baf35c081 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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;
}