如何实现对文件的拷贝和删除?
谢谢!

解决方案 »

  1.   

    BOOL CopyFile(
      LPCTSTR lpExistingFileName,                         
      LPCTSTR lpNewFileName,
      BOOL bFailIfExists      
    );
    例:
    char src[255],dst[255];
    strcpy(src,"c:\\text.txt");//已经存在的文件
    strcpy(dst,"d:\\text.txt");//目标文件
    if(CopyFile((LPCTSTR)src,(LPCTSTR)dst,0))
       MessageBox("文件不存在");删除文件:
    BOOL DeleteFile(
      LPCTSTR lpFileName   // pointer to name of file to delete
    );
    例:
    char src[255];
    strcpy(src,"c:\\text.txt");//已经存在的文件
    if(!DeleteFile((LPCTSTR)src))
        MessageBox("文件不存在");
      

  2.   

    你可以调用API函数CopyFile,如: 
        Copy("C:\\MyFile.txt", "D:\\MyDir\MyFile.txt", FALSE); 
        你也可以使用SHFileOperation来实现更复杂的操作。 同理DeleteFile()
      

  3.   

    各位举的例子都是txt文件,不知其他文件可不可以,不如WAV文件。