我得到了一个参数,想查找在某个文件夹里同名的文件。也就是输入一个文件名,通过查找并得到该文件的路径名,该用什么函数,能不能给个例子,简单点的例子。谢谢各位的帮助

解决方案 »

  1.   

    The SearchTreeForFile function searches a directory tree for a specified file.
    BOOL SearchTreeForFile(
      PSTR RootPath,
      PSTR InputPathName,
      PSTR OutputPathBuffer
    );Parameters
    RootPath 
    [in] Pointer to a null-terminated string that specifies the path where the function should begin searching for the file. 
    InputPathName 
    [in] Pointer to a null-terminated string that specifies the file for which the function will search. You can use a partial path. 
    OutputPathBuffer 
    [out] Pointer to a buffer that receives the full path to the file that is found. This string is not modified if the return value is FALSE. 
    Requirements
    Client: Included in Windows XP, Windows 2000 Professional.
    Server: Included in Windows .NET Server 2003, Windows 2000 Server.
    Redistributable: Requires DbgHelp.dll on Windows NT 4.0 and Windows 95/98/Me.
    Header: Declared in Dbghelp.h.
    Library: Use Dbghelp.lib.