Yeah I study C++ at my school (moving very slow though) but I have been skipping ahead and read a pretty old (from 1995) book on basic C++.
I have been using the string-class before.
I know a little about how memory is being allocated since the book covers some of that and I have been reading about how to create/prevent a buffer overflow (which assumes knowledge about the memory stack and how memory is allocated). I have also looked at some assembler-code which (afaik) works alot with the memory.
I am sorry if using the wrong "terms" but I don't speak english so much so I have some problems with it. :P
Anyway the thing is for example I will let the program listen to a certain port by opening a socket. I later used the port as the second argument (./server 3010) and then converted it to a int and used it. Now I am trying to make an easy-looking configure-file that will define the port instead.
And I was hoping that I could use the format as I wrote before (it would maby be easier to use #define, but I am not afraid of trying complicated stuff). So lets say that I have two lines in the conf-file like this:
# give me a port
From here I have made my program ignore the #-comment and seperate "port" and "3010", then putting them into two different variables (or how should I put it? :P).
if (!strcmp(option, "port"))
else if (!strcmp(option, "logfile"))
Of course I could use a "if" to check whether the name is "port" or "logfile" if I have only those two able to be set in the conf-file and then use "else" to show that the option was not a valide one.
But if I would have 50 different valid names of the option-part (port, logfile, logformat, alertlog, banfile, greeting, names, etc, etc) the if-part would be enormous, in-efficient and not very dynamical.
How should this be solved and please keep the english pretty simple so I won't have to buy a dictionary (those online suck).