I'm looking for some kind of tutorial for writing a tool that does the following:
It reads multiple values and compares them to a small database and then reads a string from the database which is assigned to the values.
So lets say we gather val1, val2 and val3 with the program it would be cool to have a database file with a format like that:
/* val1, val2, val3, matching string */
0, 0, 0, "Stringallzero"
0, 1, 0, "Stringval2is1"
473, 2, 5, "Yet another string"
The "," as separator would work for me as I won't have to use them in the strings.
Can this be done somehow easily and can the performance keep up with a "in-code" database using switch() - which is my current solution:
This is ugly and makes the binaries quite big...and the database can't be altered without re-compiling which is quite annoying, too...Code:
switch (val 1)
case 0: switch (val 2)
So if anyone has a piece of code or knows some good tutorial please let me know ;)