例如文件E﹕test.jpg要拷貝到F:\images中﹐怎麼實現﹖
詳細點﹐謝謝

解决方案 »

  1.   

    BOOL CopyFile(
      LPCTSTR lpExistingFileName, // name of an existing file
      LPCTSTR lpNewFileName,      // name of new file
      BOOL bFailIfExists          // operation if file exists
    );
    bFailIfExists [in]If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.如把C:\1\2.TXT ,拷到D:\1 下,代码:
    SetCurrentDirectory("c:\\1\\");
    CopyFile("2.txt","d:\\1\2.txt",false);
      

  2.   

    CopyFile(已有文件名,目的文件名, 是否覆盖已有文件);
    其中第三个参数为TRUE时,如果目的文件已存在,那么函数返回FALSE;
    第三个参数为FALSE时,如果目的文件名已存在,那么函数将覆盖目的文件返回TRUE;
      

  3.   

    CopyFile("E:\\test.jpg", "F:\\images\\test.jpg", FALSE);