-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
51 lines (35 loc) · 936 Bytes
/
Copy pathmain.cpp
File metadata and controls
51 lines (35 loc) · 936 Bytes
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
#pragma comment(lib, "wsock32.lib")
#include "headers\Headers.h"
#include <conio.h>
WSADATA ws;
int main()
{
WSAStartup(0x101, &ws); // Initialize the process of wsock32.dll library
CommandLine *cmd = new CommandLine();
Control *control = new Control();
Commands command;
bool exit = false;
do {
char *request = NULL;
cmd->setCommandLine();
request = cmd->getRequest();
if (Command::haveAnyArgs(request)) {
command = Command::getCommandByStroke(request, true);
char *args = NULL;
args = Command::getCommandLineArguments(request);
control->setControlWithParams(command, args);
free(args);
exit = false;
}
else {
command = Command::getCommandByStroke(request, false);
control->setControl(command);
exit = true;
}
free(request);
} while ((command != EXIT) || !exit);
delete cmd, control;
Sleep(1000);
WSACleanup(); // Clear filled resources for WinSock
return 0;
}