Dan
Dan

Reputation: 221

C (WinAPI) - get size of internet file

I download files from the Internet using InternetOpenUrl and InternetReadFile. How do I get the size of a file prior to downloading? When downloading manually from the Internet, you can see total size just as the download process begins, but how do I get that size?

Upvotes: 2

Views: 1040

Answers (1)

Dmitry Grigoryev
Dmitry Grigoryev

Reputation: 3203

According to MSDN you should use HttpQueryInfo to get the size of a resource accessed with InternetOpenUrl. The corresponding query flag is called HTTP_QUERY_CONTENT_LENGTH.

Upvotes: 4

Related Questions