再线等候,如何修改文件夹的名字
要代码 问题点数:20、回复次数:6Top
1 楼whz_time(TimesWU)回复于 2002-03-11 10:41:58 得分 10
//example for CFile::Rename
extern char* pOldName;
extern char* pNewName;
TRY
{
CFile::Rename( pOldName, pNewName );
}
不知这个能不能帮你:
CATCH( CFileException, e )
{
#ifdef _DEBUG
afxDump << "File " << pOldName << " not found, cause = "
<< e->m_cause << "\n";
#endif
}
END_CATCH
Top
2 楼whz_time(TimesWU)回复于 2002-03-11 10:43:23 得分 0
还有这个:
#include <stdio.h>
void main( void )
{
int result;
char old[] = "RENAMER.OBJ", new[] = "RENAMER.JBO";
/* Attempt to rename file: */
result = rename( old, new );
if( result != 0 )
printf( "Could not rename '%s'\n", old );
else
printf( "File '%s' renamed to '%s'\n", old, new );
}
Top
3 楼lithe()回复于 2002-03-11 10:44:10 得分 0
等等,我试试先Top
4 楼whz_time(TimesWU)回复于 2002-03-11 10:45:03 得分 0
据说上面的代码也可以修改文件夹,你试试吧!Top
5 楼blindbird(BB)回复于 2002-03-11 10:45:12 得分 10
MoveFile
The MoveFile function moves an existing file or a directory, including its children.
To specify how to move the file, use the MoveFileEx function.
BOOL MoveFile(
LPCTSTR lpExistingFileName, // file name
LPCTSTR lpNewFileName // new file name
);
The MoveFile function will move (rename) either a file or a directory (including its children) either in the same directory or across directories. The one caveat is that the MoveFile function will fail on directory moves when the destination is on a different volume.Top
6 楼blindbird(BB)回复于 2002-03-11 10:46:08 得分 0
MSDN 里面的标准答案!^_^Top
7 楼lithe()回复于 2002-03-11 11:01:24 得分 0
OK,散分Top




