formattedRead and whitespace-separated variables
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Tue Apr 9 04:42:15 PDT 2013
Hello all,
A bit of a naive question here as text processing isn't my forte ...
Suppose I have a data file containing whitespace-separated variables, i.e.
1 2 3
4 5 6
7 8 9
10 11 12
...etc.
Naively it's easy to do something like (having got a stripped string of the line),
formattedRead(s, "%s %s %s", &var1, &var2, &var3);
... but is this tolerant of arbitrary differences in the whitespace between
variables? (e.g. it might be 2 spaces not 1; or a tab; or ...)
I don't think it is, so how would I tweak the formatting string so as to ensure
that any arbitrary whitespace is taken as separating the variables to read?
Thanks & best wishes,
-- Joe
More information about the Digitalmars-d-learn
mailing list