VMS C file type and stdio - help!
Leo de Wit
leo at philmds.UUCP
Tue Aug 23 20:33:16 AEST 1988
In article <351 at sdrc.UUCP> scjones at sdrc.UUCP (Larry Jones) writes:
>In article <3689 at bsu-cs.UUCP>, dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
[Rahul's reply omitted]...
>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).
Unless you're *VERY SURE* never having to port this code (and who can
nowadays), you should not use this non-portable form of fopen. If you
port to a system with ANSI style C compiler (supporting prototypes) you
have a problem with the third argument of fopen(); it has only got two
parameters on Unix.
Besides, it is not really needed, as the default file type for VAX VMS C is
stream LF, which amounts to 512 byte records. This will just read 512 byte
blocks each time (except for the last one); I checked it.
Leo.
P.S. Why in the first place couldn't they leave the library functions
alone, instead of 'adding all those nice features' (see also extra
format types in printf, etc.)? The least they (DEC) should have done is
warn inadvertent users of possible portability problems. Lucky me to
come from a Unix womb (and as such somewhat better aware of the problems) 8-).
More information about the Comp.lang.c
mailing list