CString path=_T("..\\SMS\\*.*"); \\SMS為檔案夾名
BOOL IS=finder.FindFile(path); \\查找源檔案是否存在 此處win7和win8系統中均可能查找到路徑,但XP系統中不可以
while(IS)
{
IS=FindNextFile();
if(是檔案夾)
{
呼叫遞回函式;
}
else(是檔案)
{
直接復制;
}
}
uj5u.com熱心網友回復:
SetCurrentDirectoryThe SetCurrentDirectory function changes the current directory for the current process.
BOOL SetCurrentDirectory(
LPCTSTR lpPathName // pointer to name of new current directory
);
Parameters
lpPathName
Pointer to a null-terminated string that specifies the path to the new current directory. This parameter may be a relative path or a fully qualified path. In either case, the fully qualified path of the specified directory is calculated and stored as the current directory.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
Each process has a single current directory made up of two parts:
A disk designator that is either a drive letter followed by a colon, or a server name and share name (\\servername\sharename)
A directory on the disk designator
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
See Also
File I/O Overview, File Functions, GetCurrentDirectory
GetCurrentDirectory
The GetCurrentDirectory function retrieves the current directory for the current process.
DWORD GetCurrentDirectory(
DWORD nBufferLength, // size, in characters, of directory buffer
LPTSTR lpBuffer // pointer to buffer for current directory
);
Parameters
nBufferLength
Specifies the length, in characters, of the buffer for the current directory string. The buffer length must include room for a terminating null character.
lpBuffer
Pointer to the buffer for the current directory string. This null-terminated string specifies the absolute path to the current directory.
Return Values
If the function succeeds, the return value specifies the number of characters written to the buffer, not including the terminating null character.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If the buffer pointed to by lpBuffer is not large enough, the return value specifies the required size of the buffer, including the number of bytes necessary for a terminating null character.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
See Also
File I/O Overview, File Functions, CreateDirectory,GetSystemDirectory,GetWindowsDirectory, RemoveDirectory, SetCurrentDirectory
uj5u.com熱心網友回復:
趙4老師 有沒有更加直白的解決方案呢?? 這個看不懂
uj5u.com熱心網友回復:
趙老濕說要設定一個當前的路徑或者你全部使用絕對路徑。
uj5u.com熱心網友回復:
謝謝jennyvenusBOOL IS=finder.FindFile(path絕對路徑); 是可以獲取到的 但是直接使用絕對路徑大大降低了專案靈活性
我從XML檔案中讀取的是相對路徑 現在解決方法是想將讀取出的相對路徑轉換成絕對路徑。
那么基于vs2010MFC下利用c++怎么將相對路徑轉換為絕對路徑呢??? 還請指教。。。非常感謝
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/127716.html
標籤:基礎類
上一篇:有關VC中列印紙張方向控制
