* VAX C Binary Stream File Question
@ 1995-01-23 16:57 jgreen
1995-01-24 17:02 ` Hein RMS van den Heuvel
1995-01-24 20:41 ` Ken Cowan
0 siblings, 2 replies; 3+ messages in thread
From: jgreen @ 1995-01-23 16:57 UTC (permalink / raw)
I'm trying to read binary data from a STREAM file and write
it out as a fixed-length record format file. The problem is,
the C library functions (or the RMS functions underneath) are
still interpreting control characters, thus scrambling
information. Example
The input file has two words:
ABCDEFEF 0000000B
After reading the file, the buffer will contain
xxxxxxAB CDEFEF0B
i.e., somewhere I'm losing those 24 bits of '0'
I'm opening the file with the statement:
in_file = fopen(file_name, "rb", "ctx=bin", "rfm=stm");
John Green - jgreen@acm.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: VAX C Binary Stream File Question
1995-01-23 16:57 VAX C Binary Stream File Question jgreen
@ 1995-01-24 17:02 ` Hein RMS van den Heuvel
1995-01-24 20:41 ` Ken Cowan
1 sibling, 0 replies; 3+ messages in thread
From: Hein RMS van den Heuvel @ 1995-01-24 17:02 UTC (permalink / raw)
In article <3g0n5h$2b1@hopper.acm.org>, jgreen@ACM.ORG writes...
>I'm trying to read binary data from a STREAM file and write
>it out as a fixed-length record format file. The problem is,
>the C library functions (or the RMS functions underneath) are
>still interpreting control characters, thus scrambling
>information. Example
There is an unfortunate naming clash for STREAM files.
For *decades* Digital had used the term STREAM/STM on RSTS/E, RSX and VMS
to mean a very particular format with specific semantics: STREAM-11 / STM-11
Since, the industry, and Unix in particular, has used that
same word but uses it to describe what on VMS would correspond
better with STREAM_LF or even UNDEFINED files.
The semantics for STM-11 tell RMS to SKIP leading zeros in records :-(.
This is the way it is defined, so RMS (and the C RTL) obliges.
Please consider trying STREAM_LF or UNDEFINED files for your work.
Hope this helps, +--------------------------------------+
Hein van den Heuvel, Digital. | All opinions expressed are mine, and |
"Makers of VMS and other | may not reflect those of my employer |
fine Operating Systems." +--------------------------------------+
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: VAX C Binary Stream File Question
1995-01-23 16:57 VAX C Binary Stream File Question jgreen
1995-01-24 17:02 ` Hein RMS van den Heuvel
@ 1995-01-24 20:41 ` Ken Cowan
1 sibling, 0 replies; 3+ messages in thread
From: Ken Cowan @ 1995-01-24 20:41 UTC (permalink / raw)
In article <3g0n5h$2b1@hopper.acm.org>, jgreen@ACM.ORG writes:
|>I'm trying to read binary data from a STREAM file and write
|>it out as a fixed-length record format file. The problem is,
|>the C library functions (or the RMS functions underneath) are
|>still interpreting control characters, thus scrambling
|>information. Example
|>
|>The input file has two words:
|>
|>ABCDEFEF 0000000B
|>
|>After reading the file, the buffer will contain
|>
|>xxxxxxAB CDEFEF0B
|>
|>i.e., somewhere I'm losing those 24 bits of '0'
|>
|>I'm opening the file with the statement:
|>
|>in_file = fopen(file_name, "rb", "ctx=bin", "rfm=stm");
|>
|>
|>John Green - jgreen@acm.org
|>
Are do you really want to convert the file or just change the
file attributes? If the file had cr/lf pairs inserted when
it was written, then those would need to be stripped out,
but there is the potential that you could have a pattern
of hex 0a0d (or is it hex 0d0a?) in your data. The C RTL
can't know which 0a0d pair is data and which is the end of
record marker.
If what you want to do is to take all the bytes of a file
and treat it like fixed length records, then the $ SET FILE /ATTRIB
command or Joe Meadow's FILE utility should do what you want.
For SET FILE, something like: $ set file /attrib=(rfm:fix, mrs:30) a.c
--
Ken Cowan, ZK2-3/Q8 cowan@rtl.enet.dec.com
Digital Equipment Corporation decwrl!rtl!cowan
110 Spit Brook Rd,
Nashua, NH 03062
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1995-01-24 20:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-01-23 16:57 VAX C Binary Stream File Question jgreen
1995-01-24 17:02 ` Hein RMS van den Heuvel
1995-01-24 20:41 ` Ken Cowan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox