bool TiXmlDocument::LoadFile(const char *filename,void *mem,int len,TiXmlEncoding encoding) { // There was a really terrifying little bug here. The code: // value = filename // in the STL case, cause the assignment method of the std::string to // be called. What is strange, is that the std::string had the same // address as it's c_str() method, and so bad things happen. Looks // like a bug in the Microsoft STL implementation. // See STL_STRING_BUG above. // Fixed with the StringToBuffer class. value = filename; // reading in binary mode so that tinyxml can normalize the EOL NXU_FILE *file = nxu_fopen(value.c_str(), "rb", mem, len); if (file) { bool result = LoadFile(file, encoding); nxu_fclose(file); return result; } else { SetError(TIXML_ERROR_OPENING_NXU_FILE, 0, 0, TIXML_ENCODING_UNKNOWN); return false; } }
bool TiXmlDocument::SaveFile(const char *filename)const { // The old c stuff lives on... NXU_FILE *fp = nxu_fopen(filename, "w"); if (fp) { bool result = SaveFile(fp); nxu_fclose(fp); return result; } return false; }
UserStream::UserStream(const char *filename, bool load): fp(NULL) { fp = nxu_fopen(filename, load ? "rb" : "wb"); }