void CXML::SaveBinary( const char* filename ) { std::ofstream file; file.open(filename, std::ios_base::out|std::ios_base::binary); SaveBinary( file ); file.close(); }
int NeuralNet::Load(char *pWeightFile, char *pNormFile, int bunchSize) { // cut off suffix and add '.nbin' char pbin_file[1024]; strcpy(pbin_file, pWeightFile); char *pdot = strrchr(pbin_file, '.'); char *pslash = strrchr(pbin_file, NN_SLASH); if(pdot != 0 && (pslash == 0 || pdot > pslash)) { *pdot = '\0'; } strcat(pbin_file, ".nbin"); // load binary if the file exists if(LoadBinary(pbin_file, bunchSize) == NN_OK) { return NN_OK; } // load ascii otherwise and save it binary int ret = LoadAscii(pWeightFile, pNormFile, bunchSize); if(ret == NN_OK) { SaveBinary(pbin_file); } return ret; }
bool CTwiBootProgDoc::SaveFile() { CString FilePath = GetPathName(); CString FileName = GetTitle(); if ((m_FileType == ftUnknown) || FileName.IsEmpty() || FileName.IsEmpty()) return SaveFileAs(); bool rVal = false; switch (m_FileType) { case ftBinary: rVal = SaveBinary(FilePath); break; case ftIntelHex: rVal = SaveIntelHex(FilePath); break; default: ASSERT(FALSE); rVal = false; break; } if (rVal) SetModifiedFlag(FALSE); return rVal; }
void CXML::SaveBinary( std::ostream& stream ) { SaveBinary(stream,GetRootElement(),m_head.GetAttribute("encoding"),0); }
void Save(T const& t) { SaveBinary(&t, sizeof(T)); }