joy0861,你的文件大师里的文件分割的代码可以给我吗? 谢谢,高分哦~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void CCut::OnKaishi() { 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);} MFC 开发家庭财务管理信息系统 在工程已经设置为multi-byte character的情况下出现"字符集"错误。 编程中遇到了这个错误,关于CClientDC和CDC的,各位帮忙啊!!谢谢!!! 请问如何自己写一个类似word文本框的功能? 请问如何根据对方MAC判断其机器是否在运行? 散分:快过年了,祝大家新春快乐! 大家编程的素材都是从哪找的?比如背景或一些漂亮的程序结构 请问这句代码是什么意思? 新手求助,如何把文档类指针传给对话框 如何设置dshow的参考时钟? CSocket 从一个跟view类不相干的类得到view类的句柄?
{
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);
}