Currently I am working to create a command line function that will alter data from an ini file.
The catch is to do this I will change the string in the startup array in the object defined. The code is restricted to not use C++ strings, but character arrays.
program <name>=<value>
My issue seems to be that if I want to do
program <name>=<value> <name>=<value> it will overwrite the data needed.
Now even if I was to put all those variables outside the loop the issue still comes up that another pair overwrites argument.Code:for( command line args) { char argument[256]; char *name; char *value; //tokenize argument into name and value //insert into object }
Is there a way to make sure each argument creates new memory without having to allocate it?
or is allocating memory the only way?
btw: I also have thought about changing name and value to their own char arrays but this shouldn't make a difference because I believe my problem has to do with scope and lifetime, not the variables I am using (unless Im completely wrong)