1.
bool DataLoaderController::GetDBIdFromFile() {
FILE *f;
if (f= fopen(kDBIdFilePath, "r")) {
DBIdBuffer db_id_buffer;
size_t ret = fread(&db_id_buffer, sizeof(DBIdBuffer), 1, f);
if (ret == 1) {
online_video_db_id_ = db_id_buffer.online_video_db_id_;
hotshare_video_db_id_ = db_id_buffer.hotshare_video_db_id_;
hotshare_album_db_id_ = db_id_buffer.hotshare_album_db_id_;
hotshare_db_insert_count_ = db_id_buffer.hotshare_db_insert_count_;
MCE_DEBUG("DataLoaderController::GetDBIdFromFile() ----> online_video_db_id_:"<<online_video_db_id_<<" hotshare_video_db_id:"<<hotshare_video_db_id_
<<" hotshare_album_db_id_:"<<hotshare_album_db_id_<<" hotshare_db_insert_count_:"<<hotshare_db_insert_count_);
} else {
MCE_WARN("DataLoaderController::GetDBIdFromFile() ----> Fail to get dbids from dbid.conf.");
}
fclose(f);
return true;
} else {
MCE_WARN("DataLoaderController::GetDBIdFromFile() ----> Fail to open dbid.conf.");
}
return false;
}
2.
bool IMWindowManagerI::GetUserListFromFile(const string file_path, set<Ice::Int> &temp_users) {
TimeStat ts;
bool ret =true;
ifstream ifile(file_path.c_str()) ;
if (!ifile) {
MCE_WARN("IMWindowManagerI::GetReceiversFromFile Fail to open file ,path:" << file_path);
ret = false;
}
if (ret) {
char buf[128];
for(int i=0; !ifile.eof(); i++) {
if (ifile.getline(buf , sizeof(buf)-1).good()) {
Ice::Int id = atoi(buf);
if (id >0)
temp_users.insert(id);
} else {
ret = false;
break;
}
}
}
MCE_INFO("IMWindowManagerI::GetWhiteListFromFile----> usetime : " << ts.getTime() << "temp_users.size:" << temp_users.size() << " file_path:" << file_path);
return ret;
}