// // load // void Load_ConfigFile(void) { Set_ErrorLog(); // set up the error log f_config = fopen(CONFIG_FILE_NAME, "r"); if (f_config == NULL) { Add_ErrorLog(ID_FILE_NOT_FOUND); // create a new file config.ini Rewrite_File(); //Read_ConfigFile(f_newfile); // Note: I left the comment above // because you may need it later // right now, the code writes a file // based on the default values // then closes the new file // // Another approach might be to write // the new file and then reread the new // file and check the variables // it is really a matter of // "if there are bugs then check here" // Check_Errors(); return; } // end of the function Read_ConfigFile(f_config); fclose(f_config); Check_Errors(); } // end of the function
bool Check_Errors(Node *self) { Node *child; if (self == NULL || self->type == ERROR) return TRUE; for (child = self->children; child != NULL; child = child->sibling) { if (Check_Errors(child) == TRUE) return TRUE; } return FALSE; }