The application accepts the following commands "open",
"store", "retr", "clear", "close" as input from the command line and executes
them. The application can also pick up and execute commands from
C:\commands.txt" if the file exists.
Stack in the below description is implemented by the program and does not refer to process stack.
Commands |
Operation |
open <string> |
Creates an object for Class conn and calls the constructor with the provided string as argument Constructor: 1. Allocates memory for the provided string 2. Copies the provided string to the newly allocated memory 3. Pushes the allocated string in the stack. |
store <string> |
Allocates memory for the provided string Copies the provided string to the newly allocated memory Calls set member function with allocated string as argument Set function: 1. Pushes the allocated string in the stack |
retr |
Calls the get member function Get function: 1. Returns the top member of the stack. It does not pop the element out of stack |
clear |
Calls the clear member function Clear function: 1. Gets the top member of the stack 2. Frees the memory of the top member using .free. 3. Pops the top member out of the stack |
close |
Frees the "conn" object |