M
Michael R. Copeland
I'm processing a control file comprised of many types of lines, with
some containing variable data. I have a problem parsing the following
data:
18 12.2 7.145 6.214 Phase distances
First, I've read the entire line and have manually extracted the
record type (18). Now I must parse the (3) real values that follow,
only knowing (from other data previously read) that there are 3 values
there. The number of blanks separating the fields can vary, too.
I can use sscanf, I suppose, by coding a series of switch-based calls
that have 1-n %f format specifiers and 1-n array element references -
but that's cumbersome and limiting (if I encounter more data than I've
coded for). There must be a way to do this common sort of thing, but I
can't see it. 8<{{ Any thoughts? TIA
some containing variable data. I have a problem parsing the following
data:
18 12.2 7.145 6.214 Phase distances
First, I've read the entire line and have manually extracted the
record type (18). Now I must parse the (3) real values that follow,
only knowing (from other data previously read) that there are 3 values
there. The number of blanks separating the fields can vary, too.
I can use sscanf, I suppose, by coding a series of switch-based calls
that have 1-n %f format specifiers and 1-n array element references -
but that's cumbersome and limiting (if I encounter more data than I've
coded for). There must be a way to do this common sort of thing, but I
can't see it. 8<{{ Any thoughts? TIA