It is necessary, using a file from the Internet (for example, http://example.ru/baza.txt ), write it into any variable and continue working with this variable. It is advisable not to use any libraries (third-party, from the Internet), but to use the standard ones.


What functions can be used to implement the above?

If not difficult, specify the link libraries when calling this function ( #include "example" ).


I use IDE Visual Studio 15 with the v140 toolkit.

    2 answers 2

    The easiest option is wininet.h out of the box. Function InternetReadFile () , examples of use - in bulk.

      You can try using the following function from Urlmon.h :

       HRESULT URLDownloadToFile( LPUNKNOWN pCaller, LPCTSTR szURL, LPCTSTR szFileName, _Reserved_ DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB ); 

      Those. the algorithm is as follows: download data to a file, and then work as you are used to with the file. Although in the "variable" save it, at least whatever you want to do.

      For help, contact MSDN: https://msdn.microsoft.com/en-us/library/ms775123(v=vs.85).aspx

      • Not suitable, file is being downloaded to the computer, for the user it is a bad signal. I would only commemorate - Castiel
      • @Castiel, this is a bad signal for the user, if it is a virus :) And so, there are at least any Temp catalogs, just for such purposes. And if your file is a couple of gigabytes? ;) - Sublihim
      • In addition, there are all sorts of CreateFileMapping to display files in memory. - Sublihim