先说下背景情况:我以前是搞C#的,C++基本小白。最近被老板拉了壮丁来接手前任程序员留下的一个C++项目,由于前任两年前离职(即是说项目中断了2年,现任老板现在想恢复),而且当时走得不愉快,无任何交接和文档,程序也是各种残缺报错的,导致我现在十分苦逼。
回到问题,请大家帮忙看一下这里是少了什么BCB插件?还是少了什么引用?
贴出代码:
char* WINAPI DownloadFile(char* fileUrl, int& iResult)
{
iResult = 0;
TIdHTTP * IdHTTP1;
TMemoryStream* pMemoStream = NULL;
AnsiString strFileURL = AnsiString(fileUrl);
int iLast = strFileURL.LastDelimiter("/");
AnsiString fileName = strFileURL.SubString(iLast+1, strFileURL.Length()-iLast);
strFileURL = TIdURI::URLEncode(NULL,strFileURL);
try
{
IdHTTP1 = new TIdHTTP(NULL);
pMemoStream = new TMemoryStream();
if(IdHTTP1->Connected())
IdHTTP1->Disconnect();
IdHTTP1->Get(strFileURL,pMemoStream);
pMemoStream->SaveToFile(fileName);
delete pMemoStream;
pMemoStream=NULL;
}
catch(Exception &e)
{
if (IdHTTP1!=NULL)
{
delete IdHTTP1;
IdHTTP1 = NULL;
}
if (pMemoStream!=NULL)
{
delete pMemoStream;
pMemoStream=NULL;
}
SSDWriteLog(" Call DownloadFile Error;"+ e.Message);
}
return NULL;
}