Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: cowan@btgmax.zko.dec.com (Ken Cowan)
Subject: Re: VAX C Binary Stream File Question
Date: 24 Jan 1995 20:41:13 GMT	[thread overview]
Message-ID: <3g3ol9$l5l@jac.zko.dec.com> (raw)
In-Reply-To: 3g0n5h$2b1@hopper.acm.org


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


      parent reply	other threads:[~1995-01-24 20:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox