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

Sandro Cumerlato sandro.cumerlato at gmail.com
Thu Mar 23 06:29:38 CET 2017


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>
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 at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20170323/0584d916/attachment.html>


More information about the fpc-pascal mailing list