[fpc-pascal] FreePascal Windows - Force files to write to disk

James Richters james at productionautomation.net
Wed Mar 22 23:47:04 CET 2017


I'm trying to use copyfile and cannot get it to work,  anyone have any ideas?

I'm using the procedure below.  My writeln showing the contents of the variables seems to indicate they are correct.  The souce file does exist and is correct, the destination file does not exitst.
I get an error 50 which is 

ERROR_NOT_SUPPORTED  50 (0x32)
    The request is not supported.

I don't see how copying a file I just created is not supported.  Does anyone have any ideas how to get this to work or what I may be doing wrong, or if there is a better way I should be copying my file?   I've tried using single quotes and double quotes around the file names.

Thanks

James


Uses
   Serial,Windows,jwanative,sysutils;

Procedure Copy_Backup_Rename(CBR_Filename:String);
var
  fileSource, fileDest: string;
  resultsofit : Boolean;

Begin
   fileSource := chr(39)+Prog_Drive+Prog_Path+'\'+CBR_Filename+'.tmp'+chr(39);
   fileDest := chr(39)+'C:'+Prog_Path+'\'+CBR_Filename+'.temp'+chr(39);
   writeln (filesource+'    '+filedest);
   resultsofit := CopyFile(PChar(fileSource), PChar(fileDest), False);
   writeln (resultsofit);
   writeln(getlasterror);
End;

Console output:
'C:\ProMill\BitTool.tmp'    'C:\ProMill\BitTool.temp'
FALSE
50




More information about the fpc-pascal mailing list