bmp是不知大小,但一点小于65535byte。我自己写了一个,但是10k的只能恢复到9.29k。请问原因何在?
CString m_name = "c:\\winnt\\zapotec.bmp";
CFile MyFile1,MyFile2;
if(!(MyFile1.Open(_T(m_name),CFile::modeRead)))
{
AfxMessageBox("Can't open file");
}
if(!(MyFile2.Open("11.bmp",CFile::modeWrite ¦CFile::modeCreate)))
{
AfxMessageBox("Can't creat file");
}
long Length = MyFile1.GetLength();
char pData[65535];
char *p;
p = pData;
MyFile1.Read((void *)pData,(UINT)Length);
char sData[127];
CString Data,rData;
long i,k;
for(i=0;i
1<length ¦cfile::modecreate)))="" *)pdata,(uint)length);="" *)rdata.getbuffer(rdata.getlength()),(uint)length);="" *p;="" 126;i++)="" ;="" \---------------------------------------------------------------="" afxmessagebox("can't="" block="Length/127;" bmp文件中有可能会有0字节,不能当作字符串来对待。你这样处理当然有问题="" cfile="" char="" creat="" cstring="" data.format("%c",sdata);="" file");="" for(i="0,k=0;i<Length%126;i++,k++)" for(int="" for(k="0;k<126;k++)" i="0;i<Length/127;i++)" if(!(myfile1.open(_t(m_name),cfile::moderead)))="" if(!(myfile2.open("11.bmp",cfile::modewrite="" if(left="" int="" left="Length-block*127;" length="MyFile1.GetLength();" long="" m_name="c:\\\winnt\\\zapotec.bmp" myfile1,myfile2;="" myfile1.close();="" myfile1.read((void="" myfile2.close();="" myfile2.write((void="" myfile2.write(p+127*i,127);="" open="" p="pData;" p++;="" pdata[65535];="" rdata="rData+Data;" sdata[k]="*p;" {="" }="" 下面这样不是很简单吗="" 把bmp文件作为普通的流式文件来对待,把它分割还原就可以了.="" 请问这个程序有什么问题?如果有更简单的,望告知!="">0)
2MyFile2.Write(p+127*block,left);
3MyFile1.Close();
4MyFile2.Close();
5\---------------------------------------------------------------
6
7不能用CString,用64个字节循环读并且发送就行了。</length>