Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

getcwd line break 80 characters

Martin_D_1
Beginner
902 Views

Dear All,

I'm using the getcwd function on Ubuntu Linux and the return string contains a newline statement if the current directory name is longer than 80 characters:

program myWD

 use IFPORT

 implicit none
 character(len=1024)           :: cwd
 integer                       :: error

 error = getcwd(cwd)
 print*, trim(cwd)//':'
 
end program myWD

will give

 /nethome/storage/raid4/m.diehl/DAMASK/testing/Spectral_parsingArguments/referen
 ce:
/nethome/storage/raid4/m.diehl/DAMASK/testing/Spectral_parsingArguments/refere:

if I call the program from the folder 'reference' and 'refere', respectively. Tested with ifort 13.0.1 and 12.1.2.

 

0 Kudos
2 Replies
Martin_D_1
Beginner
902 Views

sorry, formatting didn't work:

I'm using the getcwd function on Ubuntu Linux and the return string contains a newline statement if the current directory name is longer than 80 characters:

[fortran]program myWD

use IFPORT

implicit none

character(len=1024) :: cwd

integer ::error

error = getcwd(cwd)

print*, trim(cwd)//':'

end program myWD

[/fortran]

will give

[bash]

/nethome/storage/raid4/m.diehl/DAMASK/testing/Spectral_parsingArguments/referen

ce:

/nethome/storage/raid4/m.diehl/DAMASK/testing/Spectral_parsingArguments/refere:

[/bash]

if I call the program from the folder 'reference' and 'refere', respectively. Tested with ifort 13.0.1 and 12.1.2.

0 Kudos
Martin_D_1
Beginner
902 Views

I've investigated and figured out that it's just a formatting problem and every line will break after 80 characters. The underlying reason was, that my directory detection never works but with the help of

http://software.intel.com/en-us/forums/topic/274704

it now does. For gfortran, I can simply use the directory + '/.' and check for file existance

0 Kudos
Reply