From: Colin Watters on 15 May 2010 16:16 "robin" <robin51(a)dodo.com.au> wrote in message news:4beebcd4$0$67491$c30e37c6(a)exi-reader.telstra.net... > "ralf.schaa" <ralf.schaa(a)gmail.com> wrote in message > news:9d0c8560-5f06-4ae5-af5b-57c78975f8f0(a)t14g2000prm.googlegroups.com... > |I am struggling to get something like the following to work - is it > | possible at all? > | cheers > | -ralf > | > | program main > | character( : ), allocatable :: theStr > | call GetStr( theStr ) > | > | contains > | > | subroutine GetStr( theStr ) > | character( : ), allocatable, intent( out ) :: theStr > | > | ! open a file etc. > | > | ! read the string from the file > | ! dynamic allocation of 'theStr' ??? > | read( funit, * ) theStr > > You need to read the string into a temporary, > Then you need to allocate "theStr", > and then you can assign the temporary to it. > > | end subroutine GetStr > | end program main > > You need to read Richard Maine's posting, and learn something. -- Qolin Email: my qname at domain dot com Domain: qomputing
First
|
Prev
|
Pages: 1 2 Prev: abort on end-of-file Next: Need efficient Fortran equivalent to Matlab accumarray |