c++-ios


C++ Binary File I/O Operations Slow Down… How DB Handle Binary Files?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-16 09:06:42
问题 I am trying to make a simple file-based hash table. Here is my insert member function: private: std::fstream f; // std::ios::in | std::ios::out | std::ios::binary public: void insert(const char* this_key, long this_value) { char* that_key; long that_value; long this_hash = std::hash<std::string>{}(this_key) % M; long that_hash; // also block status long block = this_hash; long offset = block * BLOCK_SIZE; while (true) { this->f.seekg(offset); this->f.read((char*) &that_hash, sizeof(long)); if

工具导航Map