Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. narlytep

    changes in input files

    PROGRAM a REAL::b open (2,file="INPUTS.txt",action="read",status="OLD") open (3,file="OUTPUTS.txt",action="write",status="REPLACE") DO i= 1,9,2 READ(2,*)b READ(2,*) WRITE(3,*)(b) END DO b=0 DO i= 1,5 WRITE(3,*) b END DO CLOSE(2) CLOSE(3) END PROGRAM
  2. narlytep

    changes in input files

    Easiest way is to have a second loop at the end that writes out 0 five times, before you close the file.
  3. narlytep

    changes in input files

    That's just a case of swapping the order of the two reads, so that the second read is the one that stores b. do i= 1,9,2 READ(2,*) READ(2,*)b WRITE(3,*)(b) END DO There's probably a nice clever way to do this with an if statement so you can switch back and forth between the two options, but...
  4. narlytep

    changes in input files

    Hmm. It works for me. The only way I can get an error to appear is if my INPUTS.txt file only has 9 lines of data. You'll need a 10th otherwise it runs off the end of the file with the second read.
  5. narlytep

    changes in input files

    The problem you have is that all you have done with the stride of 2 is turn a loop of 40 indexes to one of 20. The read will still read each line in turn and then write them out, so you'll just get the first 20 lines in the file. You could change the loop to this: do i= 1,40,2 READ(2,*)b...
  6. narlytep

    Trying to use an extended type

    Ah, yes. I did mean for them to be pointers of course. :) Good idea about the reg_data_type flag. Thanks!
  7. narlytep

    Trying to use an extended type

    Hi. Thanks for the replies. xwb, your first suggestion of setting it as a target seemed to do the trick. Your longer example just segfaults for me when it tries to access the data within the type. salgerman, yes, it's all common source code. We're writing two libraries that share a lot of...
  8. narlytep

    Trying to use an extended type

    Hi. I have a piece of code that has several libraries sharing a common code base. The libraries are compiled from this common base plus their own bits of unique code. One piece of data that all the libraries share is a "Phase Type", a derived type containing several common pieces of data...
  9. narlytep

    passing pointer component of derived type into subroutine

    Hi. One of our users is having a problem and I'm a bit stumped as well. They're trying to pass a pointer component of a derived type into a subroutine and treating it as a normal array at the other end. However the data is ending up as garbage. Is this legal? module mod type deriv...
  10. narlytep

    Is this legal ?

    Hi there, I've got a bit of code that I've been given to work on. It uses a structure constructor to initialise a derived type, but it uses a function within the constructor to set a pointer. Is it legal to do this ? I'm getting different results on different compilers (Intel's compiler is...

Part and Inventory Search

Back
Top