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

James Richters james at productionautomation.net
Thu Mar 23 11:33:54 CET 2017

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.




From: fpc-pascal [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Sandro Cumerlato
Sent: Thursday, March 23, 2017 1:30 AM
To: FPC-Pascal users discussions <fpc-pascal at 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" <james at productionautomation.net <mailto:james at 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

    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.




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

   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);

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

fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org <mailto:fpc-pascal at lists.freepascal.org> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170323/5795167b/attachment.html>

More information about the fpc-pascal mailing list