Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28629 Discussions

syntax for copy-command inside Fortran

tropfen
New Contributor I
364 Views
Hello,

is there a syntax inside fortran which works as a copy-command (like DELFILESQQ or RENAMEQQ). I can't use the SYSTEM-syntax because of blanks inside the file names.

If yes, please send a short example/description in your answer.

Thanks for help in advance
Frank
0 Kudos
1 Reply
Les_Neilson
Valued Contributor II
364 Views

OK. a very rough and ready solution :

Code:

use ifwinty

character*80 file1, file2

integer(BOOL) :: cp
logical :: ires

      interface
         integer function CopyFileA (file1,file2,res)
           !dec$ attributes stdcall, alias:'_CopyFileA@12' :: CopyFileA
           character*(*) :: file1 [reference]
           character*(*) :: file2 [reference]
           logical*4     :: res [reference]
         end function CopyFileA
      end interface

ires  = .false.
file1 = "first file.txt"C
file2 = "copy of first file.txt"C

cp = CopyFileA(file1, file2, ires)


Les

0 Kudos
Reply