Xref: utzoo comp.lang.c:12062 comp.os.vms:8248 Path: utzoo!attcan!uunet!sdrc!scjones From: scjones@sdrc.UUCP (Larry Jones) Newsgroups: comp.lang.c,comp.os.vms Subject: Re: VMS C file type and stdio - help! Keywords: 512 byte records, stream LF Message-ID: <359@sdrc.UUCP> Date: 24 Aug 88 20:11:43 GMT References: <196@rna.UUCP> <6671@bloom-beacon.MIT.EDU> <3689@bsu-cs.UUCP> <613@philmds.UUCP> Organization: Structural Dynamics Research Corp., Cincinnati Lines: 32 In article <613@philmds.UUCP>, leo@philmds.UUCP (Leo de Wit) writes: > In article <351@sdrc.UUCP> scjones@sdrc.UUCP (Larry Jones) writes: > [stuff about using DEC extensions to fopen to get the correct record > structure] > > 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. Well, I wouldn't say you shouldn't use it, but I will say you should put an "#ifdef vax11c" around it! > 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. This is wrong - if it wasn't needed, why would people be asking how to do it? The problem is not reading the file with C, the problem is with programs which are written in other languages which read RECORDS - something C has no (or at least very little) concept of. If you try to read a record from a stream-LF file, RMS gives you everything up to the next linefeed. If your buffer isn't big enought to hold it, you get an error and loose data. Record format IS significant. ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC scjones@sdrc 2000 Eastman Dr. BIX: ltl Milford, OH 45150 AT&T: (513) 576-2070 Nancy Reagan on superconductivity: "Just say mho."