As we have all been taught, a sucessfull call to 'fopen' returns a stream.
If the stream is 'seekable', then we expect the calls ftell and fseek to
work, and if it is not seekable, we expect these calls to to return
errors.
Well, we are just plain ignorant. If we open a vms "record format" file,
everything you know is wrong. I quote the "VAX C Runtime Library Reference
Manual":
ftell - ....With record files, ftell returns the starting position of the
current record, not the current byte offset, (sic) which repositions the
file to where it was when ftell was called.
fseek - ....With record files, fseek .... causes unpredictable behavior.
But, of course, you can get a stream to act like a stream simply by
opening it with an "optional file attribute option" which is an RMS keyword
attribute pair:
...
"ctx=stm" Force stream mode access.
...
Oh, silly me, I thought fopen opened a stream, and that it was portable...
------
The best thing about all this is that it has changed somewhere along the
way, at some release of the VMS C RTL, this was different.
The fix to the VMS recent netcdf bug is to add "ctx=stm" to the fopen
"optional file attribute options" in netcdf/src/file.c.
Regards.
glenn
5c5
< /* $Id: file.c,v 1.48 1991/08/01 21:00:43 davis Exp $ */
---
> /* $Id: file.c,v 1.49 1991/08/27 02:37:02 davis Exp $ */
169c169
< "mbf=2","mbc=16") ;
---
> "ctx=stm","mbf=2","mbc=16") ;
474c474
< "mbf=2","mbc=16") ;
---
> "ctx=stm","mbf=2","mbc=16") ;