BUTTON代码键:
         
void CPDlg::OnConvert() 
{
// TODO: Add your control notification handler code here
char buf[4096];
CString filename;
filename=m_edit;
CFile file;
file.Open(L"123.txt",CFile::modeReadWrite);
file.Read(buf,sizeof(buf));
file.Write(comment(buf),sizeof(comment(buf)));
file.Close();}COMMENT函数:
         CString CPDlg::comment(char *buf)
    {
   int count=0;
   int n,m;
   CString str;
   str=buf;
  
   n=str.Find(L"//",0);
   m=str.Find(L"/n",0);
   str.Delete (n,m-n);
    return(str);
}123.TXT 随便提供有"//"符号的几个字符串和前面没"//"的字符串不知道为什么好象FIND和DELETE函数没起到作用,请高手来个痛快点的.

解决方案 »

  1.   

    n=str.Find(L"//",0);
       m=str.Find(L"/n",0);

    n=str.Find(L"//",0);
       m=str.Find(L"/n",n);
    这也不行
      

  2.   

    n=str.Find(L"//",0); 这句是没问题的,是不是str本身值有问题?
      

  3.   

    有空帮你看看
    -----------------------------------IT者--IT开发者的网站  10万篇技术资料 天天更新
      http://www.itzhe.cn
      

  4.   

    file.Write(comment(buf),sizeof(comment(buf)));
    这里好像有问题,怎么看都只会写4个字节
    还有"/n"是不是想写"\n"?
      

  5.   

    "//", "/n"  ---> "\\", '\n' //???
    越看越像是把斜杠搞错了