wininet - How can I download the HTML contents of a webpage using C++ -
wininet - How can I download the HTML contents of a webpage using C++ -
this question has reply here:
what undefined reference/unresolved external symbol error , how prepare it? 23 answershere code
#include <iostream> #include <windows.h> #include <wininet.h> using namespace std; int main() { hinternet hsession, hurl; char* buffer = new char[1024]; dword bufferlen, byteswritten; handle filehandle; hsession = internetopena(null, 0, null, null, 0); hurl = internetopenurla(hsession, "http://www.google.co.uk", null, 0, 0, 0); filehandle = createfilea("c:\\temp.txt", generic_write, file_share_write, null, create_new, file_attribute_normal, 0); byteswritten = 0; { internetreadfile(hurl, buffer, 1024, &bufferlen); writefile(filehandle, buffer, bufferlen, &byteswritten, null); } while (bufferlen != 0); closehandle(filehandle); internetclosehandle(hurl); internetclosehandle(hsession); shellexecutea(0, "open", "c:\\temp.txt", null, null, 1); cout << "operation complete!"; system("pause"); homecoming 0; }
here errors encountering
error lnk2019: unresolved external symbol __imp__internetopena@20 referenced in function _main error lnk2019: unresolved external symbol __imp__internetclosehandle@4 referenced in function _main error lnk2019: unresolved external symbol __imp__internetopenurla@24 referenced in function _main error lnk2019: unresolved external symbol __imp__internetreadfile@16 referenced in function _main
i don't understand going wrong. have imported wininet.h , windows.h. why still having problem locating these functions? regards.
what have done include header file, not linked actual code implements it.
include wininet.lib in project.
project->properties->configuration properties->linker->input->additional dependencies
c++ wininet
Comments
Post a Comment