They are Paradox files. Being (say) MyFile.db and MyFile.px .
Perhaps I should mention that the reason for this is I want to be able to copy a particular file from a known folder into another known folder and (whilst doing so) rename it.
Renamefile just renames the file. With MoveFile you can move and rename a file.
OldName and NewName are of string type and can therefor contain complete mapping.
If you let me have your e-mail address - to delphiman@bigpond.com - I can send you a model by seperate e-mail of a solution to something you have a problem with.
I suspect the problem might be that the file in question is active. But then I expect Delphi to raise an exception.
I might add that what I should be doing is to copy the file to the required folder.
But in this connection I have found the folowing in Delphi Help ..
The runtime library does not provide any routines for copying a file. However, if you are writing Windows-only applications, you can directly call the Windows API CopyFile function to copy a file. Like most of the Delphi runtime library file routines, CopyFile takes a filename as
a parameter, not a Handle. When copying a file, be aware that the file attributes for the existing file are copied to the new file, but the security attributes are not. CopyFile is also useful when moving files across drives because neither the Delphi RenameFile function nor the Windows API MoveFile function can rename/move files
across drives.
I think you can use copyfile even if the file is in use.
By the way, there is a .pas file in the delphi demos located at C:\Program Files\Borland\Delphi6\Demos\Doc\Filmanex\fmxutils.pas that contains a number of file related functions. One thing to remember is that the functions share names with the api calls, but with different parameters. The order in which the Windows unit and the fmxutils unit are listed in the calling unit will determine which one comes up if you use copyfile(). You can alleviate the problem by calling Windows.copyfile or fmxutils.copyfile. One benefit of the fmxutils is that you don't have to type pchar() for the string parameters.
Brian
"There are 2 kinds of people in the world, those that divide people into two groups and those that don't. I belong to the second group." - tag line I stole
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.