VMS C file type and stdio - help!

Larry Jones scjones at sdrc.UUCP
Thu Aug 25 06:11:43 AEST 1988


In article <613 at philmds.UUCP>, leo at philmds.UUCP (Leo de Wit) writes:
> In article <351 at sdrc.UUCP> scjones at 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 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