请问谁有网络数据报连接的程序,能否借小弟参考一下主要是关于recvfrom()和sendto()函数的用法,还有小弟想看看如何分割文件和合并已分割文件的程序,谢谢了。
我的e-mail: [email protected]
我的e-mail: [email protected]
解决方案 »
- 在用VC编写DLL中如何才能使用OPENGL的函数和变量?
- 如何在win32工程里面的dialog窗口上面显示html页面
- WTL开发界面是不是跟SDK一样难?
- 关于 3des
- 怎么在dll中的对话框中使用ActiveX控件?
- 请教ftp搜索引擎的问题!100分!进来就有!谢谢
- MSDN难道说的不对(关于 suspendthread)
- 一个有趣的关于变量的问题。。。请高手指点
- 缺省产生的SDI、MDI、DIALOG程序各有几个窗口(WINDOW),包括看不见的?
- 求助【DirectX游戏开发终极指南】 绘制模型问题
- 簡單問題﹐再開一貼﹐C/C++ C++ / 面向对象版沒得答案
- 老婆要生孩子&&▲▲▲,散分保平安
{
hebingneirong="copy ";//初始化合并文件内容
// TODO: Add your control notification handler code here
//得到正确的存放位置
if (m_savepath.Right (1)!='\\')
m_savepath=m_savepath + '\\';
GetDlgItem(IDC_PER)->GetWindowText(m_per);//m_per关联设置的分割后每份文件的大小
long per;//得到每份文件得大小,单位是K字节
per=atoi(m_per);
per=per*1024;//单位变为字节
if(per>=total)
{
MessageBox("分割后的文件大于或等于分割前的!重新设置。","错误,重新设置",MB_ICONERROR);
return;
}
CFile fsource,ftarget;
CStdioFile hebing;
if(!fsource.Open (m_sorcepath,CFile::modeRead))
{
MessageBox("打开原文件时失败!","打开文件失败",MB_ICONERROR);
return;
}
int index,index1=0;//index为生成文件得个数,index1为生成每个文件时要循环得次数
int houzhui=0;//生成文件得后缀名
////////////////
//计算大循环需要的次数
if(total%per==0)
index=total/per;
else index=total/per+1;
/////////////////////////
BYTE buffer[4096];//分配4k大小的缓冲区
///////////////////////////////////////////////////
//主循环体
CString m_source;//临时设置的生成文件名字的存储地方
char s[20];
int ncount;
long shengyu;//每次小循环不足4k的部分
shengyu=per%4096;
CString hebingwenjian=m_savepath+filename+".bat";
if(!hebing.Open (hebingwenjian,CStdioFile::modeCreate|CFile::modeWrite))
{
MessageBox("创建合并执行程序时失败!","写文件失败",MB_ICONERROR);
hebing.Close ();
return;
}
while(index!=0)
{
//计算生成每个小文件需要的循环次数,这个次数比实际的要少一次
index1=per/4096;
///////////////////////////////
itoa(houzhui,s,10);
m_source=m_savepath+filename;
m_source+=s;
houzhui++;
if(!ftarget.Open (m_source,CFile::modeCreate|CFile::modeWrite))
{
MessageBox("写文件时失败!","写文件失败",MB_ICONERROR);
ftarget.Close ();
return;
}
while(index1!=0)
{
ncount=fsource.Read (buffer,4096);
ftarget.Write (buffer,ncount);
index1--;
}
if(ncount!=0)
{
ncount=fsource.Read (buffer,shengyu);
ftarget.Write (buffer,ncount);
}
if ((index-1)!=0)
hebingneirong=hebingneirong + m_source + "/b+";
else hebingneirong=hebingneirong + m_source + "/b";
index--;
ftarget.Close ();
}
fsource.Close ();
UpdateData(TRUE);
hebingneirong=hebingneirong+ " " + m_savepath + filename;
hebing.WriteString (hebingneirong);
hebing.Close ();
MessageBox("恭喜,分割成功!","恭喜",MB_ICONINFORMATION);
}
文件分割代码写成这样,我确实服了你!