Results 1 to 2 of 2

Thread: Fortran Problem

  1. #1
    Join Date
    Jul 2013
    Posts
    1

    Unanswered: Fortran Problem

    Hi everyone!
    I have a problem in compiling a program i made in fortran because of an error that occur in this line:
    str=char(iachar('0')+ord/10)char(iachar('0')+mod(ord,10))'.par'
    open(lin,file=str,status='old')
    I have defined ord as an integer, and str as a character, and that particular portion of code is insered in a do cicle (do ord=1,10) because i want that the program open the file named 01.par 02.par ... 09.par 10.par

    How can i fix it?
    Thank you for your answers

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    Code:
    dimension digit(10)
    digit(1)='0'
    digit(2)='1'
    ...
    digit(10)='9'
    str=digit(1+ord/10)//digit(1+mod(ord,10))//'.par'
    The problem with your code is that there are no concatenation operators on the str= line.
    Code:
    str=char(iachar('0')+ord/10)//char(iachar('0')+mod(ord,10))//'.par'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •