I am writing a program that deals with reading a text file.
Based on the starting keyword of each line in a file, i want to call a different function.
void funnel(string line) {
if (line.find("Keyword1", 0) == 0){
call_function1();
}
else if (line.find("Keyword2", 0) == 0){
call_function2();
}
else if (line.find("Keyword3", 0) == 0){
call_function3();
}
............
}
Is there a simpler/better/more efficient way to do this or am i stuck with this void funnel thing?
ClientConnect: (blake_won) ID: 0 (IP: 192.168.0.177:29071)
Kill: 0 0 7: blake_won killed blake_two by MOD_SWORD
The lines look something like this, and i want to call an appropriate function based on each starting keyword. The file is not my own so i don't have control over what's written to it.