From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,eabc4e58782dd44f X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1995-01-24 13:38:11 PST Path: pad-thai.cam.ov.com!bloom-beacon.mit.edu!panix!news.mathworks.com!udel!gatech!newsxfer.itd.umich.edu!caen!crl.dec.com!crl.dec.com!jac.zko.dec.com!btgmax.zko.dec.com!cowan From: cowan@btgmax.zko.dec.com (Ken Cowan) Newsgroups: comp.sys.dec Subject: Re: VAX C Binary Stream File Question Date: 24 Jan 1995 20:41:13 GMT Organization: Digital Equipment Corporation Distribution: world Message-ID: <3g3ol9$l5l@jac.zko.dec.com> References: <3g0n5h$2b1@hopper.acm.org> Reply-To: cowan@rtl.enet.dec.com NNTP-Posting-Host: btgmax.zko.dec.com X-Newsreader: mxrn 6.18-9 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