Originally posted by: lala
how to download a file through proxy (firewall)
ReplyOriginally posted by: David
error LNK2001: unresolved external symbol __imp__HttpQueryInfoA@20
Debug/Download.exe : fatal error LNK1120: 1 unresolved externals
this is what I get when I try to link my code using this
snippet of code:
char szSizeBuffer[32];
DWORD dwLengthSizeBuffer = 32;
BOOL bQuery = ::HttpQueryInfo(mysession,HTTP_QUERY_CONTENT_LENGTH, szSizeBuffer, &dwLengthSizeBuffer, NULL) ;
if(bQuery)
{
i = atol(szSizeBuffer);
}
else
i=0;
any idea?.
thx in advance.
Reply
Originally posted by: Adam
is there any possibility to use this code with a simple cc-compiler on solaris?
Reply
Originally posted by: Benjamin Mayrargue
use HTTP_QUERY_FLAG_NUMBER along with HTTP_QUERY_CONTENT_LENGTH.
...
CInternetSession mysession;
CStdioFile *remotefile = mysession.OpenURL(url,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
//Retreive file length
If( !::HttpQueryInfo(mysession, HTTP_QUERY_CONTENT_LENGTH|HTTP_QUERY_FLAG_NUMBER, sizeof(DWORD), &dwLength, NULL))
dwLength=0;
CFile myfile(filename, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
int numbytes;
...
B. Mayrargue
http://softbird.free.fr
Originally posted by: Roman
It will better to know the size of file before downloading. I know that they say about two solutions of this task. The first is to calculate size with the help of CStdioFile::SeekToEnd(). The second is to use CHttpFile::QueryInfo.
But in some cases (I mean in some servers) it doesn't work. Do you know any methods else.
Reply