<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic You don't need to do the in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Get-a-file-s-absolute-path/m-p/1106103#M127986</link>
    <description>&lt;P&gt;You don't need to do the TRANSFER. You're allowed to pass a non-1-length character variable to an array of characters. This is a special exemption carved out in the standard. Note that no length is passed, so you still have to make sure that the buffer you pass is large enough and that the NUL termination is properly handled.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Mar 2016 19:11:26 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2016-03-10T19:11:26Z</dc:date>
    <item>
      <title>Get a file's absolute path</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Get-a-file-s-absolute-path/m-p/1106100#M127983</link>
      <description>&lt;P&gt;Is there a native way in Fortran to get a file's absolute path? &amp;nbsp;I feel like this should be something you could obtain with INQUIRE but not currently available.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I have spent the last few days trying to interface Fortran with C functions realpath() and canonicalize_file_name() to obtain a file's absolute path but I am having trouble with that -- which will most likely be another post.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance for any help.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 14:44:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Get-a-file-s-absolute-path/m-p/1106100#M127983</guid>
      <dc:creator>efengle</dc:creator>
      <dc:date>2016-03-10T14:44:01Z</dc:date>
    </item>
    <item>
      <title>See FULLPATHQQ in the Intel</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Get-a-file-s-absolute-path/m-p/1106101#M127984</link>
      <description>&lt;P&gt;See FULLPATHQQ in the Intel Fortran documentation.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 15:47:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Get-a-file-s-absolute-path/m-p/1106101#M127984</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2016-03-10T15:47:57Z</dc:date>
    </item>
    <item>
      <title>Thank you Steve for the help.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Get-a-file-s-absolute-path/m-p/1106102#M127985</link>
      <description>&lt;P&gt;Thank you Steve for the help. &amp;nbsp;I try to stay away from Intel's IFPORT module only to try to be Fortran vendor independent (I know I can use preprocessing to determine vendor...etc), but I will use for the time being. &amp;nbsp;I did however get a working Fortran interface and test program using C realpath().&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;program test
use, intrinsic :: iso_c_binding
implicit none

! Constants
integer, parameter :: PATH_MAX=1024 ! Safer to get from the system

! Define
integer :: n
character(len=:), allocatable :: file_name
character(len=1) :: a(PATH_MAX)
character(len=PATH_MAX) :: aa
type(c_ptr) :: ptr

! Fortran interface to C function, realpath()
interface
   function realpath(path,resolved_path) bind(c,name="realpath")
   use, intrinsic :: iso_c_binding
   type(c_ptr) :: realpath
   character(len=1,kind=c_char), intent(in) :: path(*)
   character(len=1,kind=c_char), intent(out) :: resolved_path(*)
   end function realpath
end interface

! Initialize
a=""
file_name="./bin/connect"//C_NULL_CHAR

ptr=realpath(file_name,a)

! Transfer character array to character string
aa=transfer(a,aa)

! Determine the first null char
do n=1,PATH_MAX
   if(iachar(aa(n:n)).eq.0) exit
end do

! Print
print *,"File name = ",file_name
print *,"Absolute file name = ",aa(1:n-1)

end program test&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 18:56:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Get-a-file-s-absolute-path/m-p/1106102#M127985</guid>
      <dc:creator>efengle</dc:creator>
      <dc:date>2016-03-10T18:56:29Z</dc:date>
    </item>
    <item>
      <title>You don't need to do the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Get-a-file-s-absolute-path/m-p/1106103#M127986</link>
      <description>&lt;P&gt;You don't need to do the TRANSFER. You're allowed to pass a non-1-length character variable to an array of characters. This is a special exemption carved out in the standard. Note that no length is passed, so you still have to make sure that the buffer you pass is large enough and that the NUL termination is properly handled.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 19:11:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Get-a-file-s-absolute-path/m-p/1106103#M127986</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2016-03-10T19:11:26Z</dc:date>
    </item>
  </channel>
</rss>

