gfxgfx
 
Please login or register.

Login with username, password and session length
 
gfx gfx
gfx
1568 Posts in 518 Topics by 754 Members - Latest Member: irekzawadzki December 03, 2021, 08:03:09 AM
*
gfx* Home | Help | Search | Login | Register | gfx
gfx
Absoft User Forum  |  Support  |  Macintosh  |  Opening files with spaces in their names
gfx
gfxgfx
 

Author Topic: Opening files with spaces in their names  (Read 2667 times)

lunokhod

  • Newbie
  • *
  • Posts: 2
Opening files with spaces in their names
« on: April 12, 2012, 05:40:21 AM »
I would like to open a filename that has a space in it, such as

open(12,"/Users/Me/Data 1/file.dat")

but I always get the error "No such file or directory" at runtime. I have tried

open(12,"/Users/Me/Data\ 1/file.dat")

but that doesn't work either. Does anyone know how to do this?


forumadmin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 321
Re: Opening files with spaces in their names
« Reply #1 on: April 12, 2012, 08:55:36 AM »
I can't duplicate this:

iMacPAJ:~ paj$ mkdir "sp ace"
iMacPAJ:~ paj$ echo test >"sp ace/file.dat"
iMacPAJ:~ paj$ cat t.f
        open (1,file="/Users/paj/sp ace/t.dat",err=100)
        print *,"open succeeded"
        close (1)
        stop
100     print *,"open failed"
        end
iMacPAJ:~ paj$ f90 t.f
iMacPAJ:~ paj$ ./a.out
 open succeeded
iMacPAJ:~ paj$

What version of OS X are you using and what version of Pro Fortran?

Mike Linacre

  • Sr. Member
  • ****
  • Posts: 251
Re: Opening files with spaces in their names
« Reply #2 on: April 12, 2012, 08:54:09 PM »
lunokhod, did you try putting file= before the fle name?

lunokhod

  • Newbie
  • *
  • Posts: 2
Re: Opening files with spaces in their names
« Reply #3 on: April 13, 2012, 04:21:42 AM »
Thanks for the help. I too can not reproduce this with a simple example (but can in the larger program, I need to debug this). Nevertheless, I note that there is a related problem with the Absoft Tools environment:

If I create a project in a directory "Project 1", with target name "project1", and if I try to execute this from within the Absoft Tools environment, the following happens:

A new terminal shell opens, and I receive the error

[lunokhod:~] lunokhod% /Users/lunokhod/Project
/Users/lunokhod/Project: Command not found.

It appears the executable name is being truncated at the space in the directory name.



Absoft User Forum  |  Support  |  Macintosh  |  Opening files with spaces in their names
 

gfxgfx
gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!