Hi. I am a C/C++ newbie. I am looking for advice on best practice.
I am building an application which will take an input command (string), compare it with a list of stored commands, and go off to the relevant function. What i'd like to know is; what is the best way to declare/initialise the list of commands to compare against? Should I create a struct in the header and then initialise in a constructor or something like that?
I am using a switch statement, so they must be constant (ie I can't just use the relevant string within the switch statements), so I need to create a construct of some sort. There are commands in different categories. For example, IO commands, UUT commands etc. Our application can use C++ constructs but only C functions (for compatibility).
A code snippet showing what i'd like to do:
switch(sCmdInt[1])
{
// PEB 2 RELATED COMMANDS
case "EXECUTEFILESVF":
TSL1_ExecuteWithVCCCheckCommand (sCmdInt[1])
}
Any help would be appreciated.