其他分享
首页 > 其他分享> > fwrite 接收文件错误

fwrite 接收文件错误

作者:互联网

  FILE *stream;
					   if ((stream = fopen("abc.txt", "w+")) == NULL)
					   {
						   break;
					   }
					   int ret_recv = -100;
					   while (1)
					   {
						   char request[4068] = { 0 };
						   memset(request, 0, 4068);
						   ret_recv = recv(fd, request, sizeof(request), 0); 

						   if (ret_recv == -1)
						   {
							   break;
						   }
						   fseek(stream, 0, SEEK_END);
						   if (fwrite(request, 1, ret_recv, stream) < 0){
							 
							   fclose(stream);
						   }
						   fflush(stream);
					   }
					
					 
					   fclose(stream); 
				     

  

标签:错误,stream,fwrite,request,ret,fclose,接收,recv
来源: https://www.cnblogs.com/mydis/p/15473756.html