bool FileObject::load() { std::ifstream ifs( m_path.c_str(), std::ios::in | std::ios::binary | std::ios::ate ); if ( !ifs ) return false; std::streamsize size = ifs.tellg(); ifs.seekg( 0, std::ios::beg ); std::vector< char > data( size ); data.resize( size ); ifs.read( &data[0], size ); ifs.close(); m_ctime = get_filetime( m_path ); m_data.swap( data ); return true; }
void PluginManager_Init() { bbplugins = NULL; PluginManager_FT.dwLowDateTime = PluginManager_FT.dwHighDateTime = 0; const char *path=plugrcPath(); get_filetime(path, &PluginManager_FT); FILE *fp = fopen(path,"rb"); if (fp) { char szBuffer[MAX_PATH]; while (read_next_line(fp, szBuffer, sizeof szBuffer)) parse_plugin(szBuffer); fclose(fp); } load_all_plugins(); }
//=========================================================================== int check_filetime(const char *fn, FILETIME *ft0) { FILETIME ft; return get_filetime(fn, &ft) == 0 || CompareFileTime(&ft, ft0) != 0;// > 0; }