Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29236 Discussions

reading entries from a string with unknown spaces in between

jagmohan_S_
Beginner
437 Views

Hi,
Greetings for the day !
I am trying to read a number of entries from a string where I don't know how many spaces will be there in between each entries and I have hexadecimal numbers to read from the string so I can't use unformatted read.
e.g. string -> 3 c 2cfb 0 d e
e.g. another sting -> 3 c 2cfb 0 d e

Currently I read the entries in character variables and then read hexadecimal numbers from these character variables. some like this

read (string,*) (string_entries(i),i=1,6)
do i=1,6
read(string_entries(i),'(z)')a(i)
end do

I was wondering if there is any way by which I can read directly these entries from string.

Thanks,
Jags

0 Kudos
0 Replies
Reply