代码拉取完成,页面将自动刷新
#include "databaseCurrentCourse.h"
#include"agori.h"
#include"ADEQ.h"
databaseCurrentCourse::databaseCurrentCourse()
{
pathBase = "current_course.txt";
}
bool databaseCurrentCourse::isFileExsist(string path){
ifstream fin(path);
if (!fin.is_open()){
return 0;
}
else{
return 1;
fin.close();
}
}
int databaseCurrentCourse::readFromFile(string path)
{
ifstream fin(path);
if (!fin.is_open()){
return 1;
}
int id, cap, sel;
string name, tea, type;
fin >> id >> name >> tea >> cap >> sel >> type;
while (!fin.eof()){
if (!pCourse.queryHasKey(to_string(id))){
string stId = to_string(id);
pCourse.addKey(stId);
pCourse.add(stId, 1, name);
pCourse.add(stId, 2, tea);
pCourse.add(stId, 3, to_string(cap));
pCourse.add(stId, 4, to_string(sel));
pCourse.add(stId, 5, type);
}
fin >> id >> name >> tea >> cap >> sel >> type;
}
fin.close();
writeToFile(pathBase);
return 0;
}
bool databaseCurrentCourse::writeToFile(string path)
{
ofstream fout(path);
if (!fout.is_open()){
return 1;
}
else{
For(i, 0, int(pCourse.graph.size()) - 1){
fout << str_toStringId(atoi(pCourse.graph[i][0][0])) << "\t" << pCourse.graph[i][1][0] << "\t" << pCourse.graph[i][2][0] << "\t" << pCourse.graph[i][3][0] << "\t" << pCourse.graph[i][4][0] << "\t" << pCourse.graph[i][5][0] << endl;
}
fout.close();
return 0;
}
}
databaseCurrentCourse dataCourse;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。