I'm seeing some odd behavior of SPLITPATHQQ on v15 of the compiler (compared to v14 update 2). Consider this code:
program main use ifport implicit none character(len=256) :: filepath integer(4) :: filelen character(len=256) :: drive,dir,name,ext filepath = '\\blah\blah\blah\' filelen = SPLITPATHQQ (filepath, drive, dir, name, ext) write(*,*) '---------' write(*,*) 'filepath:'//trim(filepath) write(*,*) 'drive:'//trim(drive) write(*,*) 'dir :'//trim(dir) write(*,*) 'name :'//trim(name) write(*,*) 'ext :'//trim(ext) write(*,*) '---------' filepath = 'C:\blah\blah\blah.dat' filelen = SPLITPATHQQ (filepath, drive, dir, name, ext) write(*,*) '---------' write(*,*) 'filepath:'//trim(filepath) write(*,*) 'drive:'//trim(drive) write(*,*) 'dir :'//trim(dir) write(*,*) 'name :'//trim(name) write(*,*) 'ext :'//trim(ext) write(*,*) '---------' filepath = '\\blah\blah\blah\' filelen = SPLITPATHQQ (filepath, drive, dir, name, ext) write(*,*) '---------' write(*,*) 'filepath:'//trim(filepath) write(*,*) 'drive:'//trim(drive) write(*,*) 'dir :'//trim(dir) write(*,*) 'name :'//trim(name) write(*,*) 'ext :'//trim(ext) write(*,*) '---------' end program main
The result on my PC is this:
--------- filepath:\\blah\blah\blah\ drive: dir :\\blah\blah\blah\ name : ext : --------- --------- filepath:C:\blah\blah\blah.dat drive:C: dir :\blah\blah\ name :blah ext :.dat --------- --------- filepath:\\blah\blah\blah\ drive:C: dir :\\blah\blah\blah\ name :blah ext :.dat ---------
The first time it is called, drive, name, and ext are blank as expected. (But note that the strings are not being trimmed properly, which is weird). The second time it is called, everything is fine and non-blank as expected. The third time it is called, drive, name, and ext should be blank, but they are retaining the values from the previous call. I don't believe the previous version of the compiler behaved this way.