forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Windows 7 (Again)

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Plato
View previous topic :: View next topic  
Author Message
stfark1



Joined: 02 Sep 2008
Posts: 210

PostPosted: Thu Nov 26, 2009 4:15 am    Post subject: Windows 7 (Again) Reply with quote

I am trying to run SilverFrost fortran under windows 7. When I execute the statement OPEN (UNIT=5, FILE=''F:/InputData.txt'), I get a error 146, cannot find path. I am still trying to find out why this is happening. I downloaded the latest version of SilverFrost for Windows 7, still get the error. Please let me know what ideas you may have. Thanks, Sid Kraft
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7923
Location: Salford, UK

PostPosted: Thu Nov 26, 2009 8:08 am    Post subject: Reply with quote

If the path cannot be found then why not check out its name?

It is usual to use a back slash rather than a forward slash.
Try changing to a back slash.
Does the drive F exist and can this file be found or created on this drive?
Back to top
View user's profile Send private message AIM Address
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Nov 26, 2009 11:51 am    Post subject: Reply with quote

I tested the following simple program which can be used to search for files, within ftn95. Why don't you compile and run it and see if you can find the F: drive.
Code:
   character file_name*132, message*80
   integer iostat
   call select_file (file_name, 'Project_Name')
   write (*,*) 'File ',trim(file_name),' was found'
!
   open (file=file_name, unit=11, iostat=iostat)
   write (*,*) 'iostat =',iostat
   if (iostat == 0) stop
!
   CALL FORTRAN_ERROR_MESSAGE@ (iostat, MESSAGE)
   write (*,*) MESSAGE

   end

   subroutine select_file (file_name, project)
   use mswin
!
   character (len=*) :: file_name
   character (len=*) :: project
!
   integer :: number_of_filters, i
   logical :: must_exist
!
   character (len=128)              :: path
   character (len=15),dimension (5) :: filter_names
   character (len=10),dimension (5) :: filters
   character (len=20)               :: title
!
   path              = 'c:\temp'
!
   title             = 'New Project File'
   file_name         = ' '
   number_of_filters = 4
   filter_names(1)   = 'Data files'    ; filters(1) = '*.dat'
   filter_names(2)   = 'Text files'    ; filters(2) = '*.txt'
   filter_names(3)   = 'Fortran files' ; filters(3) = '*.f95'
   filter_names(4)   = 'All files'     ; filters(4) = '*.*'
   must_exist        = .true.
!
   call get_filtered_file@ (title, file_name, path, &
                            filter_names, filters, number_of_filters, must_exist)
!
   i = index (file_name, '\', .true.)
   if (i > 0 .and. len_trim(project) > 1) then
      path = file_name(1:i)
!      call use_path_name (path, 'SET', Project)
   end if
!
   write (*,*) 'Project: ', project
   write (*,*) 'Title  : ', title
   write (*,*) 'Path   : ', path
   write (*,*) 'File   : ', file_name
!
   end subroutine select_file


It's worth a try.

John


Last edited by JohnCampbell on Thu Nov 26, 2009 11:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Nov 26, 2009 11:37 pm    Post subject: Reply with quote

It may be that you do not have read-write access for the file.
try using ACCESS="READ" in the open statement.

Also try to report the value of IOSTAT, using FORTRAN_ERROR_MESSAGE@ as taken from the help.

CHARACTER (LEN=80)::MESSAGE
INTEGER (KIND=2)::ERROR_CODE< BR>OPEN(FILE='FRED',UNIT=6,IOSTAT=ERROR_CODE)
CALL FORTRAN_ERROR_MESSAGE@(ERROR_CODE,MESSAGE)
PRINT *,MESSAGE
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Fri Dec 04, 2009 12:11 am    Post subject: Reply with quote

Sid,

Did you get to find why your open statements did not work ?

OPEN (UNIT=5, FILE = 'F:\Fortran\FORTRAN\BINB\CONSOLEIN.txt') ,
OPEN (UNIT=5, FILE = 'F:/InputData.txt')

I'd be interested to know the cause of the problem, being due to:-
- bad path name (don't use /),
- bad unit number (I always start at 11),
- access rights under Windows 7 (ACCESS="READ" may help),
- other Windows 7 issue (a few have been implied, but not proved lately), or
- something else ?

John
Back to top
View user's profile Send private message
stfark1



Joined: 02 Sep 2008
Posts: 210

PostPosted: Wed Dec 16, 2009 3:35 am    Post subject: Re: Reply with quote

JohnCampbell wrote:
I tested the following simple program which can be used to search for files, within ftn95. Why don't you compile and run it and see if you can find the F: drive.
Code:
   character file_name*132, message*80
   integer iostat
   call select_file (file_name, 'Project_Name')
   write (*,*) 'File ',trim(file_name),' was found'
!
   open (file=file_name, unit=11, iostat=iostat)
   write (*,*) 'iostat =',iostat
   if (iostat == 0) stop
!
   CALL FORTRAN_ERROR_MESSAGE@ (iostat, MESSAGE)
   write (*,*) MESSAGE

   end

   subroutine select_file (file_name, project)
   use mswin
!
   character (len=*) :: file_name
   character (len=*) :: project
!
   integer :: number_of_filters, i
   logical :: must_exist
!
   character (len=128)              :: path
   character (len=15),dimension (5) :: filter_names
   character (len=10),dimension (5) :: filters
   character (len=20)               :: title
!
   path              = 'c:\temp'
!
   title             = 'New Project File'
   file_name         = ' '
   number_of_filters = 4
   filter_names(1)   = 'Data files'    ; filters(1) = '*.dat'
   filter_names(2)   = 'Text files'    ; filters(2) = '*.txt'
   filter_names(3)   = 'Fortran files' ; filters(3) = '*.f95'
   filter_names(4)   = 'All files'     ; filters(4) = '*.*'
   must_exist        = .true.
!
   call get_filtered_file@ (title, file_name, path, &
                            filter_names, filters, number_of_filters, must_exist)
!
   i = index (file_name, '\', .true.)
   if (i > 0 .and. len_trim(project) > 1) then
      path = file_name(1:i)
!      call use_path_name (path, 'SET', Project)
   end if
!
   write (*,*) 'Project: ', project
   write (*,*) 'Title  : ', title
   write (*,*) 'Path   : ', path
   write (*,*) 'File   : ', file_name
!
   end subroutine select_file


It's worth a try.

John: I changed the backward slash to forward and it worked, thanks, Sid Kraft

John
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Wed Jan 06, 2010 1:58 pm    Post subject: Reply with quote

I cannot really contribute to this topic but rather would like to make a comment: The cut, paste, run and learn example posted as above (and eslewhere in this forum) is really a good thing. This surely is a motivation to have regular a look here and to take part in discussions.

Anyway why I like this approach: As mentioned I am in the process of leaving Matlab for the graphical interfaces and use FTN95 instead. The given example here to get file information is actually "not that" different from Matlab. This gives me some confidence to continue using FTN95 and make me feel good that in doing so is the right decission.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Plato All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group