You could use Winsock (Windows Socket Library), which is native component to the Windows SDK therefore it has no dependencies on 3rd party DLLs (Dynamic Link Libraries) or other 3rd party objects therefore it is a great choice to use but Wininet (Windows Internet Library) is also a native component to the Windows SDK and it does the job quicker than Winsock with the addition of half the trouble.
There are lot of articles of how to get source code of a website, but anyway this is the code should do the job of getting source code of a website, although I will give you the easy part to save the buffer into a file using Windows API or using the standard library for Input Output (IO) of files.
Do be aware I am using Visual C++ using Visual Studio, so I can use #pragma in order to perform a inline-linkage whereas in other compiler types such as GCC and others you may need to manually link it,
You can easily add the buffer either by byte to byte of data into the File or add the complete buffer into the file, the second recommendation is a more suitable one, for real-time purposes as it is atomic either the file is created successfully or fails, therefore it can be easier to do error checking and provides more reliability.
You're trying to pass ANSI strings to the Unicode entrypoints
The safest thing to do is alter you code to use the ANSI entrypoints directly. That is, use
InternetOpenA rather than InternetOpen
InternetOpenUrlA rather than InternetOpenUrl
(this rule applies to (almost) all WinAPI functions which take one or more string parameters.)
PS WinAPI "functions" which take strings are almost always actually macros that evaluate to the ANSI or Unicode (or Wide, hence the W) version of the function. Whether or not it evaluates to the -A or -W version of the function is controlled by the define UNICODE, which is set in Visual Studio via a project's "Character Set" property.
If you just plan to use ANSI chars the whole time, the easiest thing is to just use the -A forms of the functions directly and be done with it.
Or you need to read up about TCHARS, etc. (more macros and typedefs which swap between ANSI and Unicode.)