Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c/c++ windows api download file

#include <windows.h>

// + compiler option -lurlmon

int main() {
  /*
  HRESULT URLDownloadToFile(
             LPUNKNOWN            pCaller,
             LPCTSTR              szURL,
             LPCTSTR              szFileName,
  _Reserved_ DWORD                dwReserved,
             LPBINDSTATUSCALLBACK lpfnCB
);
  */
  
  if (URLDownloadToFileA(NULL, (LPCSTR) "http://your/file/path.ending", (LPSTR) "filename.ending", 0,
                       NULL) == S_OK) {
    // download success
    return 0;
  }
  
  return -1;
}

 
PREVIOUS NEXT
Tagged: #windows #api #download #file
ADD COMMENT
Topic
Name
1+7 =