VMS C file type and stdio - help!
Marc Johnson
marc at rna.UUCP
Thu Aug 11 04:56:48 AEST 1988
Posting this for a friend in Israel.
Any responses would be appreciated and should be e-mailed to:
rna!marc at ROCKVAX or marc%rna at rockefeller.edu.
------------------------------------------------------------------------------
I am trying to write a VMS C program that takes some data files on the
microVax and then converts them into my private binary format. So far this
seemingly trivial task has taken a week. I won't go into all of the details,
but the problem is creating a binary file. VMS doesn't just have files,
it has file types. One must choose a file type, and then put data in the
file according to the rules and limits of that type. What I want to do is
the following:
1. Use the C standard I/O calls (fopen, fwrite, fclose) to
write a stream of binary bytes into a file.
2. Use ftell to find out where I am in the file.
3. Use fseek to move to a new position in the file.
4. Create a file which kermit can access and transmit literally,
meaning that the byte sequence on the VMS system then appears
on the remote system.
I have tried most of the VMS file types, and I have not yet found one that
does what I want (STDIO binary files):
a. Using the default STDIO file type, stmlf (stream lf), the file is created
perfectly, but kermit can't send it, because even when I tell kermit that
the file is binary, it expands LF to CR-LF. Also with some files, their
internal data is such that kermit fails, because the VAX record management
software (rms) doesn't encounter a LF character during a read of reclen
characters.
b. Using the file type fixed, fwrite fails to put anything into the file.
c. Using the file type stm (stream), every four bytes are followed by CR-LF.
d. Using the file type udf (undefined), the file is written correctly, but
ftell works incorrectly, and fwrites following an fseek fail to work.
e. I haven't tried var and vfc file types, because I understand from talking
to DEC support engineers that they put extra stuff in the file to delimit
my "records."
By the way, I am creating these various file types using the extra rms
parameters of fopen: fopen("test.dat", "w+", "rfm=udf").
We have been asking DEC about this problem, and in three days, I have yet to
speak to anyone who has ever programmed in VMS C. They keep asking me what
type of records I want to write, and I keep saying I want to use STDIO (which
they have never heard of) to write a file containing binary bytes.
------------------------------------------------------------------------------
Thanks in advance, netters!
Marc Johnson for Kaare Christian
More information about the Comp.lang.c
mailing list