VMS Specific question about binary reads using fgetc
Paul Sidnell
pauls at lion.inmos.co.uk
Wed Jun 13 18:16:13 AEST 1990
>which reads a file in binary mode (fopen("filename","rb")). This piece
of code
>does not work under VMS because all of the cr's get cooked out of the file.
>The files record attribute is "Carriage Return Carriage Control". I am using
>fgetc to read data out of the file. Any hints, clues, ect. I am fairly
So you love the VAX too :-)
If your program had survived a little longer, it's dying comment may have been
"I CAN'T FIND EOF EITHER" !
My understanding (arrived at with much pain and frustration) is that if a file
already exists, the mode that you open the file in is ignored
completely. If you
delete the file and THEN fopen("filename","rb"); then a 'STREAM-LF' file
will be
created and everything will be happy again.
Similarly you will find many 'departures' from ANSII C using ftell and fseek on
non 'STREAM-LF' files.
Generally, the I/O is at it's sanest ONLY on these types of files.
Please excuse any froth around my mouth while I discuss this subject.
-------------------------------------------------------------------------------
| Disclaimer: IT'S ALL MY FAULT |
-------------------------------------------------------------------------------
More information about the Comp.lang.c
mailing list