1 BOOL AddtoFile(LPCTSTR pPathDest,LPCTSTR pPathSrc,CString& str)
2 {
3 BOOL bTrue = FALSE;
4 CFile pFile1;
5 if (pFile1.Open(pPathSrc,CFile::modeReadWrite))
6 {
7 pFile1.SeekToEnd();
8 int iLength = str.GetLength();
9 pFile1.Write(str.GetBuffer(iLength),iLength);
10 iLength = pFile1.GetLength();
11 char * pp = new char[length];
12 memset(pp,0,length);
13 pFile1.SeekToBegin();
14 pFile1.ReadHuge(pp,length);
15 CFile pFile2;
16 if (pFile2.Open(pPathDest,CFile::modeCreate|CFile::modeReadWrite))
17 {
18 pFile2.SeekToBegin();
19 pFile2.WriteHuge(pp,length);
20 bTrue = TRUE;
21 }
22 pFile2.Close();
23 delete []pp;
24 }
25 pFile1.Close();
26
27 return bTrue;;
28 }
这段代码是文件
pPathSrc内容增加一个字符串并拷贝到文件pPathDest中
是否可以将代码改的跟简洁一些呢?