求助:OpenUrl()在服务方式下运行的问题。。。
我想实现的功能是:
多次请求服务器上update.ini文件(版本更新后会修改)
现在的问题:
在控制台上每次可以读出修改后的内容,但是在服务方式下运行时,修改了update.ini文件,
读出来的内容还是和上次一样的(没有更新);
代码:
//查看是有最新版本
CInternetSession httpSession(NULL,0);
CString filePath = url + "update.ini";
try{
CHttpFile *pFile = (CHttpFile*)httpSession.OpenURL(filePath);
if(pFile)
{
CStdioFile csf;
csf.Open(m_strTempDir+"\\update.ini",CFile::modeCreate|CFile::modeWrite|CFile::typeBinary | CFile::shareDenyWrite);
char buf[20];
int m=0;
while((m=pFile->Read(buf,sizeof(buf)))>0)
{
csf.Write(buf,m);
}
csf.Flush();
csf.Close();
pFile->Flush();
pFile->Close();
httpSession.Close();
}
if(pFile) delete pFile;
if(httpSession) delete httpSession;
}catch(...)
{
log("连接中心服务器错误!");
httpSession.Close();
return FALSE;
}