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;Code:#Comment 1 [Main] string=none numeric=6 #Comment 2 [Other] string=hello numeric=19
Hopefully you can see my pattern. I am declaring my variable to be used like this:Code: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.Code: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..."Code:data[l] = (char *)realloc(data[l], (sizeof(char) * ((j - i) + 1))); l++; strncpy(data[l-1], &buffer[i], j - i);
By the way, this is on windows.