   C File output fprintf() madness!!!
  I''m having some trouble with the following code:...FILE*fp=fopen("index.html","w+");...recvbuf[len] = ''\0'';fprintf(fp,recvbuf);...fclose(fp);The problem is that the file that I generate seems to have some subtle differences as compared to what the "real" file should be.The file I output seems to be missing some characters, like the ''%'' character, which is all important in reproducing the tables in a html file that I am downloading.My file:...width=33>The "real" file:...width=33%>Does anyone know how to make the program correctly output the file? 
  Try using fwrite() instead of fprintf(). ;  fwrite() seems to be working, Thanks! ;  The problem is, your text is being used as the format control string for fprintf - characters like % have special meaning, and aren''t output as text. fwrite is better for buffers anyway, but it would have worked with fprintf(file, "%s", buf);. 