- strftime(buffer, 80, "%Y", ltime);
- year = buffer;
- strftime(buffer, 80, "%m", ltime);
- month = buffer;
- strftime(buffer, 80, "%Y-%m-%d", ltime);
- date = buffer;
-
- struct tm * gmtime(const time_t *timer);
- struct tm * localtime(const time_t * timer);
- struct stat st;
-
- file_path = location + year;
- if (stat(file_path.c_str() ,&st) != 0) {
- mkdir(file_path.c_str(), 0755);
- }
- file_path = file_path + "/" + month;
- if (stat(file_path.c_str() ,&st) != 0) {
- mkdir(file_path.c_str(), 0755);
- }
- file_path = file_path + "/" + device_id + "_" + date + ".txt";
- ofstream data_file(file_path.c_str(), ios::app);
- cout << "storing to " << file_path << ", data size " << string_list->size() << endl;
+ f_path = get_location_file(device_id, ltime);
+ ostream = W1Util::open_for_writing(f_path.c_str());