Download html file using unix
I wish there was some more context but you might be able to look at other programs like wget. wget is a common tool used for exactly this and it's old enough that it should have a simple makefile with few dependencies. Most Linux systems come with it preinstalled. CPP is almost backwards compatible with C, I can't say for certain but I work with C and often use CPP compilers when GCC is acting up.
Source for wget https://www.gnu.org/software/wget/
You should be able to build it from that or if you are determined to make your own use the source as a reference.
I hope this helps.