如何提取当前路径下的某一已知文件名的文件路径,
且把该文件路径在打开程序时默认显示在EDIT中!

解决方案 »

  1.   

    try 一个全局函数 ,但是我记不清楚了,好像是:CString GetCurrentDirectory() ;
      

  2.   

    DWORD GetFullPathName(
      LPCTSTR lpFileName,  // file name
      DWORD nBufferLength, // size of path buffer
      LPTSTR lpBuffer,     // path buffer
      LPTSTR *lpFilePart   // address of file name in path
    );
      

  3.   

    CFileFind cffcff.FindFile(..);
    cff.GetFilePath();
      

  4.   

    GetCurrentDirectory()
    详细请看MSDN
      

  5.   

    GetCurrentDirectory()
    详细请看MSDN
      

  6.   

    Create an absolute or full path name for the specified relative path name.char *_fullpath( char *absPath, const char *relPath, size_t maxLength );/* FULLPATH.C: This program demonstrates how _fullpath
     * creates a full path from a partial path.
     */#include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #include <direct.h>char full[_MAX_PATH], part[_MAX_PATH];void main( void )
    {
       while( 1 )
       {
          printf( "Enter partial path or ENTER to quit: " );
          gets( part );
          if( part[0] == 0 )
             break;      if( _fullpath( full, part, _MAX_PATH ) != NULL )
             printf( "Full path is: %s\n", full );
          else
             printf( "Invalid path\n" );
       }
    }
      

  7.   

    先使用GetCurrentDirectory()函数取得当前目录,再将文件名称添加到目录字符串。
      

  8.   

    GetCurrentDirectory()函数的具体用法是?
    我用了以下的代码,可以在单击Button时选择文件路径,
    但没法默认当前路径 CFileDialog dlg( TRUE );
    if ( dlg.DoModal() == IDOK )
    {
    m_strFilePath = dlg.GetPathName();
    UpdateData( FALSE ); }能不能提供GetCurrentDirectory()函数的用法详细到如上