- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hello,
I'm developing a workaround for a colleague that needs to perform a lot of copy statements. "Call System("copy..")" does not work in this case. Therefore I tried to call the win32 API CopyFile using the kernel32 module. It gives the following errormessage:
Error: The same named entity from different modules and/or program units cannot be referenced. [COPYFILE]
The win32 API MoveFile workes fine though. I use compiler 10.1.029.
Here's the samplecode:
Cheers, Arjen
I'm developing a workaround for a colleague that needs to perform a lot of copy statements. "Call System("copy..")" does not work in this case. Therefore I tried to call the win32 API CopyFile using the kernel32 module. It gives the following errormessage:
Error: The same named entity from different modules and/or program units cannot be referenced. [COPYFILE]
The win32 API MoveFile workes fine though. I use compiler 10.1.029.
Here's the samplecode:
[fortran]Program CopyFile Use Kernel32 Implicit None Integer(BOOL) :: retval,NotOverWrite Character(Len=200) :: lpExistingFileName,lpNewFileName NotOverwrite = 0 lpExistingFileName = "D:\TestFile.txt" lpNewFileName = "D:\TestFile_copy.txt" retval = CopyFile(Trim(lpExistingFileName)//""C,Trim(lpNewFileName)//""C,FALSE) retval = MoveFile(lpExistingFileName,lpNewFileName) End Program CopyFile [/fortran]Thanks in advance for any useful answers!
Cheers, Arjen
Link kopiert
3 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hello
Your program is named CopyFile so it interfers with the function name.
Change "program CopyFile" to "program Copy_File" and it will work.
Your program is named CopyFile so it interfers with the function name.
Change "program CopyFile" to "program Copy_File" and it will work.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Auch, that indeed solves the problem. I thought Fortran was more tolerant in the name of the Program itself. Sorry to have bothered you with this, but thanks for the help anyway!
Cheers Arjen
Cheers Arjen
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
In a Fortran program, no two entities in the "global" class may have the same name. These are: program units (main program, subroutines, functions, block data subprograms, modules), common blocks and external procedures.
Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite