Hello all,
I have a problem with some pointers. I am very new to C ...
I have a function "open_project_file", this function initializes a struct called ZConf. open_project_file should now call an external function whicht should read the project data from XML and asign the content to my struct.
Here is my dummy code:
Sorry, when not described perfect but the original code is much more complex and i don't want to post all the files. I think you could the understand the problem anyway... I know you can because you know how to hack in C... :-)Code:typedef struct _ZConf {
gchar *projectname;
gchar *projectpath;
} ZConf;
int open_project_file() {
ZConf settings;
read_xml(&settings);
/* this line does not work
!!!! i don't can access the data in the structure!!!!*/
printf(settings.projectname);
printf(settings.projectpath);
}
void read_xml(ZConf *settings) {
/* does some file integrity checks */
/* then calls: */
parse_xml(settings);
}
void parse_xml(ZConf *settings) {
/*parse the XML file and insert values to the structure */
settings->projectname = "Damn_pointers";
settings->projectpath = "/home/hanez/projects";
}
I would be very glad if someone could help me out.
Kind regards,
Johannes - hanez.org