[Info-vax] proper format for JPEG files
Jose Baars
peutbaars at googlemail.com
Thu Jul 28 18:47:35 EDT 2011
Op 7/27/2011 10:25 PM, Mark Berryman schreef:
> Both are valid although a poorly coded program can choke on either one. I've seen a number of Unix utilities that were simply compiled, not ported, on VMS that choke on the first format. Anything that uses RMS $GET code will choke on the second.
> Any program you have for reading JPEG files is likely written in C. The CRTL uses block-mode I/O and does its own internal buffering. For C programs, it all depends on how the file is opened. There are a number of permutations that work. For me, the easiest is to use "ctx=rec" if I expect to be reading records (it doesn't matter if the file is a stream format or a variable record format) or "ctx=stream" if I am reading binary data. Using "ctx=stream" will read raw data regardless of the file format.
> RMS assumes records. If you wish to read non-record oriented data using RMS, the file format must either be fixed-length records or you must use RMS block I/O.
>
Thanks, that is clear. A universal read routine that doesn't know what to
expect needs to have decision logic built in on how to properly open the
file, where most software can get away with a choice in advance, based on
the functionality (an editor will use record mode, an image processing
program block i/o), or even make do with the file type.
The decision logic is not simple, probably one of the reasons that Apache
and sftp have or had restrictions on the file formats that were supported.
I haven't seen programs choking on reading binary fix 512 files
though. How would that happen?
More information about the Info-vax
mailing list