|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
onkr
Joined: 24 Feb 2012 Posts: 2
|
Posted: Fri Feb 24, 2012 10:16 pm Post subject: openrw@ routine doesn't return zero |
|
|
Hi,
I am a pretty new user in Fortran and I am trying to use openrw@ routine as follows and it doesn't return zero even though it creates the file. Am I doing something wrong?
Program check
implicit none
integer handle, error_code
character (len=40) dosya1
call openrw@ ('dosya1',handle, error_code)
if (error_code.eq.0) then
write(*,*) 'Operation was successfull'
else
write(*,*) 'Operation was NOT successfull'
end if
end |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2585 Location: Sydney
|
Posted: Sat Feb 25, 2012 2:03 am Post subject: |
|
|
You have declared a character variable dosya1, but then used a character constant 'dosya1'.
Also, check the kind of handle and error_code.
My open routine is: Code: |
subroutine open_salford_io ( file_name, lunit, error_code )
!
! File I/O using Salford I/O library
!
character file_name*(*)
integer*2 lunit, error_code
!
lunit = -1
CALL openrw@ (file_name, lunit, error_code)
write ( *,*) 'OPEN : File ', trim (file_name),' : Handle =', lunit, ' : Error code =', error_code
if (error_code /= 0) call doserr@ (error_code)
!
end subroutine open_salford_io
|
|
|
Back to top |
|
|
onkr
Joined: 24 Feb 2012 Posts: 2
|
Posted: Mon Feb 27, 2012 4:51 pm Post subject: Re: |
|
|
I changed the constant to variable and I defined handle and error_code as integer kind 2 which solved the problem. Thanks a lot.
JohnCampbell wrote: | You have declared a character variable dosya1, but then used a character constant 'dosya1'.
Also, check the kind of handle and error_code.
My open routine is: Code: |
subroutine open_salford_io ( file_name, lunit, error_code )
!
! File I/O using Salford I/O library
!
character file_name*(*)
integer*2 lunit, error_code
!
lunit = -1
CALL openrw@ (file_name, lunit, error_code)
write ( *,*) 'OPEN : File ', trim (file_name),' : Handle =', lunit, ' : Error code =', error_code
if (error_code /= 0) call doserr@ (error_code)
!
end subroutine open_salford_io
|
|
|
|
Back to top |
|
|
|
|
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
|