Reputation: 63
To test my program, I have to manually input many line of commands which are in order. Say after running the console application of main.exe, I type many commands, command1, command2, command3.....command50. Each commands closely depends on previous command. It's tremendously annoying that I have to start fresh if an error occurs in middle. For instance, I encounter an error w/command30. I must restart the program and repeat very single command. I just wonder how can I write some codes embedding into the main.exe and behaving like unix arrow key to repeat previous commands? Thanks a lot!
Upvotes: 0
Views: 434
Reputation: 765
I just wonder how can I write some codes embedding into the main.exe and behaving like unix arrow key to repeat previous commands?
You can use stack, everytime you enter a command you push it to stack, when user press up arrow key, start iterating over the stack one by one, when user press enter key, take the command from stack and execute it( also push it onto stack).
Upvotes: 2