客户端接收到txt文件怎么没有内容?
代码如下:
s.Format("Connected to server :- %s",servername); m_list.AddString(s); sprintf(buff,"GET %s\r\n\r\n",filepath); send(conn,buff,strlen(buff),0); s.Format("sending command :- GET %s to server",filepath); m_list.AddString(s); CFile f; int y; CString fname="c:\\"; fname+=filename; f.Open(fname,CFile::modeCreate | CFile::modeWrite); s.Format("starting to receive file"); m_list.AddString(s); while(y=recv(conn,buff,4*1024,0)>0) { f.Write(buff,y); } f.Close();