I usually read a config file for my application with a " : " delimiter e.g. :
And after I read the whole line into a string, I "tokenize" it with sscanf like so:
#name : filename : value : boolstate (0 = false / 1 = true)
myConf : config.txt : 2000 : 1
I understand sscanf is a method from C, so if I wanted to make it more C++, what should I use? Or maybe there's some better way to scan the values from the string that can directly convert the variable type (e.g. from "1000" from the file to int(1000) )? Thanks in advance.
int value, tempBool;
res = sscanf ( buffer, "%s : %s : %d : %d", tempName, tempFile, &value, &tempBool);