如何实现文件拷贝重命名?拷贝已经实现了,如何重命名。

解决方案 »

  1.   

    char renamefile[255];
    sprintf(renamefile,"rename %s  %s",file1,file2);
    system(rename);
      

  2.   

    CopyFileEx
    就可以实现重命名。
    DeleteFile
      

  3.   

    有一个函数是,rename(src, dest),在windows和unix都有实现,很方便的
      

  4.   

    下面这个函数可以实现拷贝并重命名
    BOOL CopyFile(
      LPCTSTR lpExistingFileName,
                              // pointer to name of an existing file
      LPCTSTR lpNewFileName,  // pointer to filename to copy to
      BOOL bFailIfExists      // flag for operation if file exists
    );
      

  5.   


    The MoveFile function renames an existing file or a directory (including all its children). BOOL MoveFile(    LPCTSTR lpExistingFileName, // address of name of the existing file  
        LPCTSTR lpNewFileName  // address of new name for the file 
       );
     
    注意renames an existing file or a directory