不好意思。。很少用VC。。 C:\PROGRA~1\COMMON~1\SYMANT~1\VIRUSD~1\20060625.007如何取得20060625希望能具体点。。谢谢。。

解决方案 »

  1.   

    不要用Find函数直接去找。。20060625这个是会变化的。。
      

  2.   

    char sz[]="C:\\PROGRA~1\\COMMON~1\\SYMANT~1\\VIRUSD~1\\20060625.007";
    char *p=strrchr(sz,'\\');
    p++;
    p[8]='\0';
    MessageBox(p);
      

  3.   

    1. Use CString::ReverseFind to find the position of the last "\" character.
    2. Use CString::Mid to get the string ( 20060625.007 )
    3. Use CString::Find to find the position of the "." character.
    4. Use CString::Left to get the result string (20060625)
      

  4.   

    _splitpath();
    非常好用 试试吧^_^
      

  5.   

    #include <stdlib.h>
    #include <stdio.h>int main( void )
    {
       char path_buffer[_MAX_PATH];
       char drive[_MAX_DRIVE];
       char dir[_MAX_DIR];
       char fname[_MAX_FNAME];
       char ext[_MAX_EXT];   _makepath( path_buffer, "c", "\\sample\\crt\\", "makepath", "c" );
       printf( "Path created with _makepath: %s\n\n", path_buffer );
       _splitpath( path_buffer, drive, dir, fname, ext );
       printf( "Path extracted with _splitpath:\n" );
       printf( "  Drive: %s\n", drive );
       printf( "  Dir: %s\n", dir );
       printf( "  Filename: %s\n", fname );
       printf( "  Ext: %s\n", ext );
    }
    Output
    Path created with _makepath: c:\sample\crt\makepath.cPath extracted with _splitpath:
      Drive: c:
      Dir: \sample\crt\
      Filename: makepath
      Ext: .c