📄 cloadframe.cpp
字号:
#include "CLoadFrame.h"
#include "check_char.h "
#include "data_cmp.h "
#include "CPrintMessage.h "
#include "interface.h"
#include "CFile.h"
#include<windows.h>
#include <conio.h>
#include <windows.h>
void CLoadFrame::printLoadFrame()
{
string path;
CFile file;
int num;
system("cls");
CInterface::printTitle("Load From File");
while( ( (path=pathInputCtrl()) =="0" ) );
while( !getFileFromPath(path,filelist ) );
cout<<"file list:"<<endl;
int n= filelist.size();
if(n==0)
{
cout<<"sorry! there is no file!"<<endl;
system("pause");
return;
}
string *p;
int count = 0;
for(p=filelist.begin();p!=filelist.end();p++)
{
count++;
cout<<'\t'<<count<<'.'<<(*p)<<endl;
}
while( !( num = inPutCtrl(n) ));
if(file.restoreData(filelist[num-1]) ==true )
{
cout<<"load successfull!"<<endl;
system("pause");
}
}
/////////////////////////////////////////////////////////
bool CLoadFrame::getFileFromPath(string &path,vector<string>& filelist)
{
WIN32_FIND_DATA file_info = {0};
string tmp=path+"\\*.bak";
filelist.clear();
HANDLE handle = FindFirstFile(tmp.c_str(),&file_info);
if (NULL != handle && INVALID_HANDLE_VALUE != handle)
{
do {
filelist.push_back(file_info.cFileName);
} while (FindNextFile( handle, &file_info ));
FindClose(handle);
}
return true;
}
///////////////////////////////////////////////////////////////
int CLoadFrame::inPutCtrl(int n)
{
cout<<"please make a choice from file list:";
char ch_input = getche();
if(!(C_check_char::checkChar(ch_input)==1))
{
CPrintMessage::printMessage(C_check_char::checkChar(ch_input));
system("pause");
return 0;
}
else
{
if( !( (ch_input>='1')&&(ch_input<=('0'+n) ) ) )
{
cout<<endl<<"ERROR INFO:"<<endl;
cout<<"sorry!!,input is out of range!!";
system("pause");
return 0;
}
else
{
char temp[10];
temp[0]=ch_input;
temp[1]='\0';
return atoi(temp);
}
}
return -1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -