Does this string processing work for you?
- From: "David Frank" <dave_frank@xxxxxxxxxxx>
- Date: Tue, 27 Sep 2005 08:55:51 GMT
Below works on CVF because:
1. it terminates list input when it encounters a null char during the read.
2. it makes available the list index count on error exit
So does below work on your non-CVF system?
If it does, it represents the simplest/shortest method yet shown to process
unknown integer items from file record.
I posted below over in comp.lang.pl1 in rebuttal to some horrific PL/I
string-handling code thats currently being discussed and in reply to a
comp.lang.fortran regular, Glen Hermansfeldt's un-substantiated claim " PL/I
has better string-handling than Fortran"
! -------------------
program process_string ! thats input from file record?
character(200) :: s = '1,2,3,4,5,6,7'
integer :: v(100), n
s(len_trim(s)+1:) = ' ' // char(0) ! conv to cstring
read (s,*,err=1) (v(n),n=1,size(v))
1 write (*,'(999i3)') n, v(1:n-1) ! = 8 1 2 3 4 5 6 7
end program
.
- Follow-Ups:
- Re: Does this string processing work for you?
- From: David Frank
- Re: Does this string processing work for you?
- From: Herman D . Knoble
- Re: Does this string processing work for you?
- From: Arjen Markus
- Re: Does this string processing work for you?
- Prev by Date: Re: declaring array arguments in subroutines
- Next by Date: Re: Does this string processing work for you?
- Previous by thread: Intel Fortran license?
- Next by thread: Re: Does this string processing work for you?
- Index(es):