Here is what I am doing. I am writing my own ini file reader.
Pretend this is the file:
Here is how I want it to be layed out in a variable;
Hopefully you can see my pattern. I am declaring my variable to be used like this:
data = "[Main]"
data = "string=none"
data = "numeric=6"
data = "[Other]"
data = "string=hello"
data = "numeric=19"
I already have my functions to hand me my data, all I need to do now is to allocate the correct space and assign the data to it.
char **data = NULL;
I am having a lot of trouble here. Right now I just want to at least get the "sections" of the ini written (they go into the 1d part of the array). Here is what I have been currently trying to work with:
j - i return the length of the "section". I also am not getting very good error details, just a "yourprog has stopped working..."
data[l] = (char *)realloc(data[l], (sizeof(char) * ((j - i) + 1)));
strncpy(data[l-1], &buffer[i], j - i);
By the way, this is on windows.