<?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 Re: OPEN (file='...') won't recognize file name in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OPEN-file-won-t-recognize-file-name/m-p/905510#M81959</link>
    <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
The replies gave me the information I needed. Thanks for taking the time to help, guys.&lt;BR /&gt;</description>
    <pubDate>Mon, 03 Aug 2009 06:55:30 GMT</pubDate>
    <dc:creator>John_Helsdon</dc:creator>
    <dc:date>2009-08-03T06:55:30Z</dc:date>
    <item>
      <title>OPEN (file='...') won't recognize file name</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OPEN-file-won-t-recognize-file-name/m-p/905507#M81956</link>
      <description>This may be too basic here, but when I try to open a file name through a directory path, FORTRAN version w_cprof_p_11.1.038, I get error#6404 (and others) and it tells me that it must be a character string, even though I define it with quotes. I, for the life of me, can't figure this out. It works fine in non-Intel compilers. Code is attached. I tried to define part of the path as "fname", but it didn't like that, so I tried to just input file= with the file name in quotes. No go. BTW, the print of fname concatenated with the rest of the directory path worked just fine when I commented out the OPEN statement. Can anyone help?&lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;[plain]Program test_file
implicit none
character(len=68), parameter :: fname = 'c:Documents and SettingsJohn Helsdon'&amp;amp;
'My DocumentsFortrancharge'
integer :: i, j, k
real :: dx, dy, dz
print *, fname//'input.dat'
open(unit=100, file='c:Documents and SettingsJohn HelsdonMy DocumentsFortran'&amp;amp;
'chargeinput.dat', status=unknown)
read(100, *) i,j,k,dx,dy,dz
print *, 'values are ', i,j,k,dx,dy,dz
close(100)
end program test_file[/plain]&lt;/PRE&gt;
&lt;BR /&gt;</description>
      <pubDate>Sun, 02 Aug 2009 21:27:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/OPEN-file-won-t-recognize-file-name/m-p/905507#M81956</guid>
      <dc:creator>John_Helsdon</dc:creator>
      <dc:date>2009-08-02T21:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN (file='...') won't recognize file name</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OPEN-file-won-t-recognize-file-name/m-p/905508#M81957</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/206147"&gt;john.helsdon@sdsmt.edu&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;This may be too basic here, but when I try to open a file name through a directory path, FORTRAN version w_cprof_p_11.1.038, I get error#6404 (and others) and it tells me that it must be a character string, even though I define it with quotes. I, for the life of me, can't figure this out. It works fine in non-Intel compilers. Code is attached. I tried to define part of the path as "fname", but it didn't like that, so I tried to just input file= with the file name in quotes. No go. BTW, the print of fname concatenated with the rest of the directory path worked just fine when I commented out the OPEN statement. Can anyone help?&lt;BR /&gt;&lt;BR /&gt;
&lt;/EM&gt;&lt;PRE&gt;&lt;EM&gt;[plain]Program test_file
implicit none
character(len=68), parameter :: fname = 'c:Documents and SettingsJohn Helsdon'&amp;amp;
'My DocumentsFortrancharge'
integer :: i, j, k
real :: dx, dy, dz
print *, fname//'input.dat'
open(unit=100, file='c:Documents and SettingsJohn HelsdonMy DocumentsFortran'&amp;amp;
'chargeinput.dat', status=unknown)
read(100, *) i,j,k,dx,dy,dz
print *, 'values are ', i,j,k,dx,dy,dz
close(100)
end program test_file[/plain]&lt;/EM&gt;&lt;/PRE&gt;
&lt;BR /&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Your folder name for the file has spaces in it. I suggest that you add an extra level of quotes, eg,&lt;BR /&gt;&lt;BR /&gt;file = "'c: ... " &amp;amp;&lt;BR /&gt;" ... '", ... etc&lt;BR /&gt;&lt;BR /&gt;I have changed your single quotes to double quotes and then started and finished the string with a set of single quotes.&lt;BR /&gt;This means that the whole string, including the single quotes will be used to try and access the file.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;David</description>
      <pubDate>Mon, 03 Aug 2009 00:42:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/OPEN-file-won-t-recognize-file-name/m-p/905508#M81957</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2009-08-03T00:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN (file='...') won't recognize file name</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OPEN-file-won-t-recognize-file-name/m-p/905509#M81958</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
Apologies if these are just code transcription issues, but...&lt;BR /&gt;&lt;BR /&gt;On line 9, the 'unknown' argument to the status specifier needs to have quotes around it to make it into a character constant, otherwise the compiler thinks it is a variable (hence the error #6404 which is actually about a variable not having a type).&lt;BR /&gt;&lt;BR /&gt;open(..., status='unknown')&lt;BR /&gt;&lt;BR /&gt;Also your line continuation may not be doing what you think it is doing. For both your fname parameter definition and the file argument for the open statement you've got something like:&lt;BR /&gt;&lt;BR /&gt;fname='first_part'&amp;amp;&lt;BR /&gt;'second_part'&lt;BR /&gt;&lt;BR /&gt;According to free form line continuation rules, that actually looks like the following to the compiler once the lines have been spliced together:&lt;BR /&gt;&lt;BR /&gt;fname='first_part''second_part'&lt;BR /&gt;&lt;BR /&gt;Note the two sequential quotes in the middle of the "source code representation" of the character constant. That represents a single quote in the actual value for the character constant. This is probably not what you actually wanted in the middle of your filename (and hence you would see runtime errors if you used fname to form part of a file).&lt;BR /&gt;&lt;BR /&gt;If you have to split a constant across two lines consider either using an explicit concatenation operator (as for your print statement, but just have things on two lines):&lt;BR /&gt;&lt;BR /&gt;fname='first_part' &amp;amp;&lt;BR /&gt;// 'second_part'&lt;BR /&gt;&lt;BR /&gt;or explicitly use the free source method of continuing character constants:&lt;BR /&gt;&lt;BR /&gt;fname='first_part&amp;amp;&lt;BR /&gt;&amp;amp;second_part'&lt;BR /&gt;&lt;BR /&gt;(The leading ampersand on the second line is optional, but it makes things clear about what is supposed to be in the constant and what is not).&lt;BR /&gt;&lt;BR /&gt;IanH&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Aug 2009 01:46:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/OPEN-file-won-t-recognize-file-name/m-p/905509#M81958</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2009-08-03T01:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: OPEN (file='...') won't recognize file name</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OPEN-file-won-t-recognize-file-name/m-p/905510#M81959</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
The replies gave me the information I needed. Thanks for taking the time to help, guys.&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Aug 2009 06:55:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/OPEN-file-won-t-recognize-file-name/m-p/905510#M81959</guid>
      <dc:creator>John_Helsdon</dc:creator>
      <dc:date>2009-08-03T06:55:30Z</dc:date>
    </item>
  </channel>
</rss>

