level 1
☜檬猹猹
楼主
BOOL CMy629App::InitInstance()
{
CFile file1,file2;
char name[10],pw[10];
int nCount=0;
file1.Open("name.txt",CFile::modeReadWrite);
file1.Read(name,6);
file1.Close();
file2.Open("pw.txt",CFile::modeReadWrite);
file2.Read(pw,6);
file2.Close();
while(nCount<3)
{
checkdlg passdlg;
if(passdlg.DoModal()==IDOK)
if((strcmp(passdlg.m_username,name)!=0)||(strcmp(passdlg.m_password,pw)!=0))
{
MessageBox(NULL,"用户名或口令错误,请重试!","错误信息",MB_OK|MB_ICONERROR);
nCount++;
}
else
break;
else
{
return FALSE;
}
}
if(nCount>=3)
{
MessageBox(NULL,"口令输入超过三次,请退出!","错误信息",MB_OK|MB_ICONERROR);
return FALSE;
}
大家帮我看看这代码,原程序是实现弹出验证口令的窗口,才能进入主程序。
要求从文件中读取匹配的口令,这是匹配口令的代码,但怎么也匹配不成功。求教。弄一下午了
2014年12月02日 11点12分
1
{
CFile file1,file2;
char name[10],pw[10];
int nCount=0;
file1.Open("name.txt",CFile::modeReadWrite);
file1.Read(name,6);
file1.Close();
file2.Open("pw.txt",CFile::modeReadWrite);
file2.Read(pw,6);
file2.Close();
while(nCount<3)
{
checkdlg passdlg;
if(passdlg.DoModal()==IDOK)
if((strcmp(passdlg.m_username,name)!=0)||(strcmp(passdlg.m_password,pw)!=0))
{
MessageBox(NULL,"用户名或口令错误,请重试!","错误信息",MB_OK|MB_ICONERROR);
nCount++;
}
else
break;
else
{
return FALSE;
}
}
if(nCount>=3)
{
MessageBox(NULL,"口令输入超过三次,请退出!","错误信息",MB_OK|MB_ICONERROR);
return FALSE;
}
大家帮我看看这代码,原程序是实现弹出验证口令的窗口,才能进入主程序。
要求从文件中读取匹配的口令,这是匹配口令的代码,但怎么也匹配不成功。求教。弄一下午了