Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void load_map_from_file() {
- int id;
- index_data current_id;
- ifstream file;
- string file_name = "/home/twite/CLionProjects/Database/map.dat";
- file.open(file_name);
- string s;
- int a;
- streamoff b;
- while (getline (file, s)) {
- if (s == "id") {
- getline (file, s);
- std::istringstream iss(s);
- iss >> a;
- id = a;
- }
- if (s == "file_names") {
- while (getline(file, s)) {
- if (s == "--") {
- break;
- }
- current_id.file_names.push_back(s);
- }
- }
- if (s == "start_reading_positions") {
- while (getline(file, s)) {
- if (s == "--") {
- break;
- }
- std::istringstream iss(s);
- iss >> b;
- current_id.start_reading_positions.push_back(b);
- }
- }
- if (s == "end_reading_positions") {
- while (getline(file, s)) {
- if (s == "--") {
- break;
- }
- std::istringstream iss(s);
- iss >> b;
- current_id.end_reading_positions.push_back(b);
- }
- }
- if (s == "data_size") {
- getline(file, s);
- std::istringstream iss(s);
- iss >> a;
- current_id.data_size = a;
- indexes[id] = current_id;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement