- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
The following module will not compile; I am probably missing something simple. Appreciate someone pointing out the error of my ways.
MODULE command_line_arguments CONTAINS SUBROUTINE get_arguments (num_arguments, strings, & num_strings, error) IMPLICIT NONE INCLUDE 'flib.fd' ! include for GETARG and NARGS functions !---------------------------------------------------------------------- ! Calling arguments !---------------------------------------------------------------------- INTEGER, INTENT(out) :: num_arguments ! Number of arguments returned INTEGER, INTENT(in) :: num_strings ! Number of strings to hold INTEGER, INTENT(out) :: error ! Error flag: 0 = no error ! -1 = system library error ! > 0 = too many arguments CHARACTER(len=*), DIMENSION (num_strings), & INTENT(out) :: strings ! ! Array to hold arguments !---------------------------------------------------------------------- ! Type local variables !---------------------------------------------------------------------- INTEGER(2) :: i INTEGER(2) status ! Get number of arguments num_arguments = nargs() ! Check for too many argumeents IF(num_arguments > num_strings) THEN ! too many arguments error = num_arguments num_arguments = num_strings ELSE error = 0 ENDIF ! Get arguments DO i =0, num_arguments - 1 CALL getarg(i, strings(i + 1), status) IF(status < 0) THEN error = status EXIT ENDIF ENDDO END SUBROUTINE get_arguments END MODULE command_line_arguments
링크가 복사됨
1 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hmm - Replace the INCLUDE with USE DFLIB - but what you have should work. I'll look into this.
Steve
Steve
