OK I want directly store the data I get from a recv command into a file, without posting the data firstly into the char buf, because if I received a binary file over recv it stops at some points in the binary file.
Any ideas? Thanks for help.

Code:
                char buf[4096];
	FILE * pFile;
	pFile = fopen ("download.txt" , "wb");

here comes some code to open the connection.

	while ( (tlen=recv( h, buf, sizeof(buf), 0 )) > 0 ) {
		fputs (buf , pFile);
	}

fclose (pFile);