<
herrman...@gmail.com> wrote:
> On Monday, November 7, 2016 at 11:51:06 PM UTC-8, Richard Maine wrote:
> > And those tabs are likely to be part of your problem....
> Interesting. I did a cut and paste off the original post, and got blanks.
> (But not the right number for F9.2 and F9.4 format.)
> But then I did a reply, and cut/paste off the reply text, and the
> tabs were there.
Hmm. I didn't notice that. In fact I didn't notice the tabs at all until
I was trying to use a cursor to count characters and noticed it jump
over what I originally thought were blanks. So I suppose it is vaguely
possible that the tabs were a posting artifact instead of in the
original file. I'm guessing not, but I can't be sure. In any case, as
you note, the number of blanks isn't right even if they are blanks, that
being why I had been trying to count them.
> Yes, the DEC compilers, at least in the days before list directed
> input, process tabs in an unusual way.
That this might be from old DEC code (or at least from someone using
practices from those days) occurred to me after I did my prior post. I
think the Intel compiler today might still do that funny thing with tabs
for compatibility with ancient code (and coders who still use the
practice), though I'm not sure and haven't bothered to test.
> But list-directed is a better system.
Of course list-directed isn't guaranteed to do what would be needed with
the tabs here either. It would be a reasonable extension, and I'd expect
most compilers to handle it, but it isn't actually specified in the
standard. Still, I'd agree that it is probably the easiest way to deal
with this input and is *PROBABLY* reasonably portable.
Another way is to use 1x to skip over the tabs. That does assume that
the tabs are always in exactly the same column (and that something has
not "helpfully" converted them to mltiple blanks for you).
The most robust way is, alas, slightly messy. It's probably what I'd do,
but then I already have library routines that take care of all the
messiness. Read each line into a string and then parse out the fields
yourself, accepting both tabs and blanks as field separators. That way
you are not sensitive to exact positioning and can handle the tabs
regardless of whether or not something has converted them to blanks
behind your back.