1。怎样把文件中间一段去掉,紧跟着的部分接上来?
2。怎样从一个位置开始写一段,写一字节覆盖原位置的一个字节。
3。把一个文件,加到另一个文件中间去(从某位置开始,不覆盖原来的东西)?

解决方案 »

  1.   

    CFile ftmp;
    ftmp.Open(...);
    ULONGLONG dwLength = ftmp.GetLength();ftmp.Seek(pos+remove_length, CFile::begin);
    int buflen=dwLength-pos-remove_length;
    char* pbuf=new char[buflen];
    if(pbuf)
    {
    ftmp.Read(pbuf,buflen);
    }
    ftmp.SetLength(dwLength-remove_length);
    ftmp.Seek(pos, CFile::begin);
    ftmp.Write(pbuf,buflen);
      

  2.   

    it is just a thought, further work is needed in order to make it work.
      

  3.   

    老大的方法只适合小文件,大文件得用内存映射文件http://expert.csdn.net/Expert/topicview.asp?id=1432612