copyfile失灵那就是copyfile的问题.可以参考
Try
 CopyFile(pchar('c:\lzj.txt'),PChar('d:\lzj.txt'),true);
Except
End;
copyfile有三个参数,第一个为原文件的名称,第二个为要拷贝给的文件的文件名,第三个是看第二个是否存在的操作

解决方案 »

  1.   

    copyfile失灵那就是copyfile的问题,与上面的代码无关,可以参考
    copyfile(pchar('c:\lzj.txt'),PChar('d:\lzj.txt'),true);
    参数1:源文件
    参数2:目标文件
    参数3:如果目的文件存在所要做的处理
      

  2.   

    copyfile(pchar('c:\lzj.txt'),PChar('d:\lzj.txt'),true);
      

  3.   

    delphi 里 PChar 就是如同C语言一般在字符串的最后加一个结束标志对吗?
    copyfile('a.bmp',PChar(dir+'\a.bmp'),false); 
    为什么可以编译通过呢?
      

  4.   

    把源文件改为绝对路径试试,如:copyfile('C:\a.bmp',PChar(dir+'\a.bmp'),false);
      

  5.   

    SelectDirectory返回的是Boolean呀!copyfile  中的哪个是用的LPCTSTR 类型呀?你要学会查看delphi自带的帮助,很详也很准确。对一个函数直接按F1即可!爽
      

  6.   

    The CopyFile function copies an existing file to a new file. 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 
       );
     ParameterslpExistingFileNamePoints to a null-terminated string that specifies the name of an existing file. lpNewFileNamePoints to a null-terminated string that specifies the name of the new file. bFailIfExistsSpecifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. 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.  Return ValuesIf the function succeeds, the return value is nonzero.
    If the function fails, the return value is zero. To get extended error information, call GetLastError. ResSecurity attributes for the existing file are not copied to the new file. 
    File attributes (FILE_ATTRIBUTE_*) for the existing file are copied to the new file. For example, if an existing file has the FILE_ATTRIBUTE_READONLY file attribute, a copy created through a call to CopyFile will also have the FILE_ATTRIBUTE_READONLY file attribute. For further information on file attributes, see CreateFile.See AlsoCreateFile, MoveFile