I am able to download text documents (.html, .txt, etc) but I do not download images or exe can do . I am pretty sure that this is because I am using a four, and those files are binary. I know that in C # I will use a byte but in this case how will I use the data?
four buffers [1]; DWORD dwRead; FILE * pFile; PFile = fopen (file, "w"); While (internetreadfile (HRAEist, buffer, 1, and door read)) {if (dwRead! = 1) break; Fprintf (pFile, "% s", buffer); } Fclose (pFile);
Your problem is not four, it is using fprintf with% s Four
can hold all the byte values when a binary data section contains a \ 0
(faucet) character, fprintf will stop output at that time.
You want to use fwrite
in this case.
In Windows, it is also important to use the b
specification when opening binary files.
Comments
Post a Comment