Thanks for the response, it got me on the right track and I got it working.
I originally did try “ instead of ‘ and have the same results. I was using ‘ because of the example here: http://wiki.freepascal.org/CopyFile I was able to get it to work without any ‘ or “ I even did a test with a space in the file name and it worked fine without “ It appears The function must put “ around it for you. James From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Sandro Cumerlato Sent: Thursday, March 23, 2017 1:30 AM To: FPC-Pascal users discussions <fpc-pascal@lists.freepascal.org> Subject: Re: [fpc-pascal] FreePascal Windows - Force files to write to disk Try " char instead of ' (char 39). I never use ' under Windows. Best regards Sandro Cumerlato On 22 Mar 2017 23:47, "James Richters" <ja...@productionautomation.net <mailto:ja...@productionautomation.net> > wrote: 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 _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org <mailto:fpc-pascal@lists.freepascal.org> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal