Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/12/84; site nbs-amrf.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!umcp-cs!gymble!neurad!nbs-amrf!hopp
From: hopp@nbs-amrf.UUCP (Ted Hopp)
Newsgroups: net.lang
Subject: Re: Bet you can't get this problem!
Message-ID: <4@nbs-amrf.UUCP>
Date: Fri, 9-Aug-85 18:55:26 EDT
Article-I.D.: nbs-amrf.4
Posted: Fri Aug  9 18:55:26 1985
Date-Received: Mon, 12-Aug-85 07:50:56 EDT
References: <909@rayssd.UUCP>
Distribution: net
Organization: National Bureau of Standards
Lines: 42

> Now that I've got your attention, I'd like to ask if anybody has ever had
> any experience with reading a Vax VMS fortran carriage control file with
> Vax-11 C.  I want to read in one line at a time, and every line is of a
> varying length. I think this pretty much precludes using fortran i/o routines,
> as I haven't figured out how to input varying length strings in fortran (I
> could be wrong, of course!).  Currently, when I read the line in in C, the
> first column is skipped, which contains vital control data for the program
> (the program was originally written in Whitesmith C, and some workaround
> succeeded).

First of all, there is a simple way of reading variable length records in
DEC Fortran using the 'Q' format indicator.  The following fragment
illustrates the idea:

	character*80 line
	integer i

	read (6,1000) i,line(:min(i,len(line)))
1000	format (Q,A)

A 'Q' field in a format statement transfers a count of the remaining
characters in the line into the next variable, which must be an integer.
I don't remember whether 'Q' is standard Fortran 77 or another DEC-ism.

I can't help you in reading the file in C, not knowing DEC's C compiler.
If you don't mind loosing the carriage control attribute for the file
(I don't mean loosing the first byte of data!), take a look at the
convert utility, especially the /FDL qualifier.  You can create an
FDL description once for vanilla (no carriage control attribute),
variable length, sequential files and then say:

	convert/fdl=   

(I think this is how it all goes.  I don't have any manuals here at home.)

Hope this helps.

Ted Hopp	{seismo,umcp-cs}!nbs-amrf!hopp

-- 

Ted Hopp	{seismo,umcp-cs}!nbs-amrf!hopp