Xref: utzoo comp.lang.c:12028 comp.os.vms:8226 Path: utzoo!attcan!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.lang.c,comp.os.vms Subject: Re: VMS C file type and stdio - help! Summary: VMS record type doesn't need being specified Keywords: 512 byte records, stream LF Message-ID: <613@philmds.UUCP> Date: 23 Aug 88 10:33:16 GMT References: <196@rna.UUCP> <6671@bloom-beacon.MIT.EDU> <3689@bsu-cs.UUCP> <351@sdrc.UUCP> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 28 In article <351@sdrc.UUCP> scjones@sdrc.UUCP (Larry Jones) writes: >In article <3689@bsu-cs.UUCP>, dhesi@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-).