Reading Tab Separated Files

From: Alan Ross (alan_at_rebeluk.com)
Date: 10/24/04


Date: 24 Oct 2004 09:29:51 -0700

Dear All,

I am currently learning Fortran and am stuck on a problem. I have
scoured the web and this group for a solution but to no avail.
Hopefully someone would be able to point me in the right direction.

I am attempting to read in a formatted file of integer values
separated by tabs. There are three values per line. eg.

    180 807 479
    27 785 88
    145 50 429
    317 5 805
    131 77 402

I am attempting to use the following code:

    integer :: i1, i2, i3
    open(unit = 10, file = "list.dat", form = "formatted", action =
"read")
    do
        read(10, *) i1, i2, i3
        write(*,*) i1, i2, i3
    end do
    close(10)

According to the postings in this group, the free form format * should
recognise the tabs as separating the integers (btw. I am using NAGware
F95 compiler). I get the error message "Invalid input for integer
editing"

I also experimented with format statements namely fmt="(i3, t5, i3,
t9, i3)" but since the number of integer characters before the tab
varies, I have problems. So it only outputs the first line and ignores
the rest.

Could anyone please help push me in the right direction. I have spent
days on this problem now.

Thanks,

Alan



Relevant Pages

  • Re: TECH:Baby Pac Man Solenoid issue
    ... stuck solenoids means a shorted transistor or a stuck switch. ... They merely rely on a friction fit inside the socket housing so over time the fingers spread apart from the solder tabs. ... connectors as pins were worn badly. ...
    (rec.games.pinball)
  • Re: Mail Merge Envelope Inquiry
    ... paragraph marks with tabs, or you could just convert to a table separating ... Word MVP FAQ site: http://word.mvps.org ...
    (microsoft.public.word.docmanagement)
  • Re: Page layout: Tabs
    ... than two tabs between the "columns," you'll need to first replace multiple ... You should end up with a two-column table with a row for each ... Table | Convert | Table to Text, separating with paragraph marks. ... Word MVP FAQ site: http://word.mvps.org ...
    (microsoft.public.word.pagelayout)
  • Re: TECH:Baby Pac Man Solenoid issue
    ... a shorted transistor or a stuck switch. ... housing so over time the fingers spread apart from the solder tabs. ... connectors as pins were worn badly. ... screen all solenoids operate properly but none of my rollover swithces ...
    (rec.games.pinball)
  • Re: Tab wars revisited (was Re: Python indentation)
    ... it was best for people to learn vi over another editor because ... > one could be stuck with nothing but vi to do editing with since all unixes ... Right Thing with Python, is an emergency, and in an emergency, ... single spaces work as well as tabs. ...
    (comp.lang.python)