mfc 文件
问一下大家,看我的代码有什么问题:
i_Count=0;
i_FileCount=0;
ifstream fin("index.html");
while(!m_pRecordset->adoEOF)
{
i_Count++;
var = m_pRecordset->GetCollect("title");
if(var.vt != VT_NULL)
strTitle = _com_util::ConvertBSTRToString((_bstr_t)var);
var = m_pRecordset->GetCollect("class");
if(var.vt != VT_NULL)
strClass = _com_util::ConvertBSTRToString((_bstr_t)var);
var = m_pRecordset->GetCollect("num");
if(var.vt != VT_NULL)
strNum = _com_util::ConvertBSTRToString((_bstr_t)var);
if (i_Count>=20)
{
i_FileCount++;
i_Count=0;
}
m_FileName.Format("indexq[%d].html",i_FileCount);
ofstream fout(m_FileName,ios::app);
string str,str1;
str1=" <p><a href=\"/index.htm\">首页</a> / 新闻</p>";
if(i_Count==1)
{
while (getline (fin, str) )
{
fstream fout(m_FileName,ios::app);
if(fout)
{
fout<<str<<endl;
}
if(0==strcmp(str1.c_str(),str.c_str()) )
{
int m=1;
if(m)
{
ofstream fout(m_FileName,ios::app);
fout<<"<div>"<<endl;
fout<<"<h2>全部新闻</h2>"<<endl;
fout.close();
goto here;
}
}
}
here: fin.close();
}
fout<<strTitle<<"-"<<strClass<<" - "<<strNum<<" <br/>"<<endl;
fout.close();
m_pRecordset->MoveNext();
}
我是希望这个程序从数据库读数据,每20条数据库记录产生一个页面文件,
if(i_Count==1),把一个已有文件内容输入产生的页面文件。可调式的时候,
if(i_Count==1),下面的代码只执行一次不知道为什么?明明i_Count==1了,可他就是不执行下面的代码
请大家帮我看一看什么问题