将一个文件名保存在一个字符串里,怎么将该文件名的主文件名和扩展名分离?(100分)
如:
CString str="abc.txt";
CString a,b;
a=prefix(str);
b=postfix(str);
要求结果a="abc",b="txt",有没有这样的函数呢?

解决方案 »

  1.   

    Mid ------Extracts the middle part of a string (like the Basic MID$ function). 
    Left ------Extracts the left part of a string (like the Basic LEFT$ function). 
    Right ------Extracts the right part of a string (like the Basic RIGHT$ function). 
    SpanIncluding ------Extracts a substring that contains only the characters in a set. 
    SpanExcluding 
      

  2.   

    a=str.Left(str.Find("."));
    b=str.Mid(str.Find(".")+1);