Silverfrost Forums

Welcome to our forums

Windows 7 (Again)

26 Nov 2009 3:15 #5433

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

26 Nov 2009 7:08 #5435

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?

26 Nov 2009 10:51 (Edited: 26 Nov 2009 10:42) #5437

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.

   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

26 Nov 2009 10:37 #5451

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

3 Dec 2009 11:11 #5472

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

16 Dec 2009 2:35 #5556

Quoted from JohnCampbell 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.

   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

6 Jan 2010 12:58 #5656

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.

Please login to reply.