VMS C file type and stdio - help!

Larry Jones scjones at sdrc.UUCP
Fri Aug 19 07:39:22 AEST 1988


In article <3689 at bsu-cs.UUCP>, dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
> In response to the request for a solution to the problem of how to
> create a binary file under VAX/VMS that allows arbitrary seeks:  There
> is no ideal solution (other than switching to UNIX, of course), but you
> can get by if you use stream-LF files.
> 
> Kermit will not let you transfer a stream-LF file without risking
> corrupting it with newline conversions.  The standard VMS "Kermit-32"
> won't treat a stream-LF file as a binary file and sends it line by line
> instead.
> 
> Kermit transfer can still be done, however.  My bilf.c utility (that is
> included with source code for zoo 2.0) will convert between stream-LF
> and fixed-length-record (FLR) files.  So to do a Kermit transfer, use
> bilf.c to convert to FLR format, then transfer with Kermit as a binary
> file.  Or the other way around.

If you're using Digital's Vax-11 C, it's much easier to just tell it you
want fixed length records in the first place.  All you need do is add three
additional arguments on to the fopen call: "recfm=f", "mrs=512", "ctx=stm"
(that's from memory, so I hope I got them right).  The first says you want
fixed-length records, the seconds says to make them 512 bytes long, and the
last tells the C library to ignore the fact that the file is record structured
and pretend it's a stream file instead (which works just grand as long as the
records are fixed rather than variable-length).

It is worthwhile to note that the Vax-11 C documentation contains a typo
listing the last argument as "ctx=str".  It is still more interesting that
the library itself contains a bug which causes it to report some bizzare
VMS-specific error if you actually try that rather than reporting "invalid
argument value" as it should.  In any event, "ctx=stm" is correct.

----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones at sdrc
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150                  AT&T: (513) 576-2070
Nancy Reagan on superconductivity: "Just say mho."



More information about the Comp.lang.c mailing list