Is there a convienent way to take a string (input by user) and convert it to an Enumeration value? In this case, the string would be the name of the enumeration value, like
That would be a good solution :
enum e_test { a, b, c, END }; enum e_test get_enum_value(char * val) { static char const * e_test_str[] = { "a", "b", "c" }; for (int i = 0; i < END; ++i) if (!strcmp(e_test_str[i], val)) return i; return END; }