1。 CString p=s.GetBuffer(1024);
不可以用p++的形式
可以用char *pStr=s.GetBuffer(1024);
      pStr++;
2。CString p="add1 ; code1 ; add2 ; code2 ; ...",不可以用ReMove(' ; ' , " \n ")的形式,将换行符替换到p中去呢?再用一个什么函数使p输出的时候,一边换行,一边输出呢?
可以用p.Replace(":","\n");
或者p.Replace(":","\n\r");

解决方案 »

  1.   

    那用TextOut(p),可不可以一边换行,一边输出呢?
      

  2.   

    你可以参考一下C++中I/O流的实现机制,看有关的书籍上的文档介绍就可以了
    可能对CString 的用会更明白一些:里面也有许多累似的函数
      

  3.   

    TextOut(x,y,p)要换行可能性不大
      

  4.   

    我在这里想问一句,GetBuffer(int n),可不可以不用参数,直接返回char* buffer。
    还有,在DOS控制台程序中,CString所在的类在哪里?我要include,却找不到
      

  5.   

    用 str.GetBuffer(str.GetLenth())就可以了。
      

  6.   

    1。 CString p=s.GetBuffer(1024);
    不可以用p++的形式
    可以用char *pStr=s.GetBuffer(1024);
          pStr++;
    但后来想在用s进行写操作时,要先用ReleaseBuffer()释放指针。
    2。我写了一段类是的程序,希望对你有所参考。
    CString str=m;
    int length=m.GetLength();
    int find=0;
    CString d="\n";
    int step=d.GetLength();
    while(find<0)
    {
      CString str=m.Right(length);
      find=m.Find("\n");
      if(find==0)  {为空字符串}
      else  if(find>0) { CString result=str.Left(find); }
      length=lenght-find-step;}