From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,47a06d19e281eb8d X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,47a06d19e281eb8d X-Google-Attributes: gid1164f8,public X-Google-Thread: f6134,47a06d19e281eb8d X-Google-Attributes: gidf6134,public X-Google-Thread: 111731,47a06d19e281eb8d X-Google-Attributes: gid111731,public X-Google-ArrivalTime: 1994-03-03 12:15:30 PST Xref: gmd.de comp.org.decus:2868 comp.os.vms:42061 comp.sys.dec:14147 comp.unix.advocacy:1010 Path: gmd.de!Germany.EU.net!EU.net!howland.reston.ans.net!agate!dog.ee.lbl.gov!ihnp4.ucsd.edu!library.ucla.edu!csulb.edu!nic-nac.CSU.net!usc!elroy.jpl.nasa.gov!nntp-server.caltech.edu!SOL1.GPS.CALTECH.EDU!CARL From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) Newsgroups: comp.org.decus,comp.os.vms,comp.sys.dec,comp.unix.advocacy Subject: Re: Is VMS Dying? Date: 3 Mar 1994 20:15:30 GMT Organization: HST Wide Field/Planetary Camera Distribution: world Message-ID: <2l5gh2$a19@gap.cco.caltech.edu> References: Reply-To: carl@SOL1.GPS.CALTECH.EDU NNTP-Posting-Host: sol1.gps.caltech.edu In article , xmdpeph@fs2.dp7up.com writes: =>>OK, shit-for-brains. Let's examine your claim. Suppose you've got a =binary =>>file that's got records of varying length. I.e., ANY character can =appear in =>>ANY record. Not all records are the same length. How do you tell, =under UNIX, =>>where a record ends? Answer: You write your own version of a subset =of RMS to =>>run under Unix. Second question: If you want a file that obeys Unix' =>>deficient semantics, how do you do it under VMS? Answer: Ask RMS to =create a =>>stream file. => =>Carl, can you post an example of this? Let's assume that the record =>separator is ETX and that you're trying to fill a C structure =>from each record. Please post examples in both UNIX and VMS of how =>to do this. One way (not necessarily very elegant) to do that sort of thing is: #include main() { char c[8][65]; int lengths[8], nitems, i, j, x; FILE *fp; if ((fp = fopen("TEST.DAT", "w", "rfm=stmlf")) == NULL) { perror("Open failed"); exit(0); } for(i = 0; i < 8; ++i) for(j = 0; j < 64; ++j) putc(j, fp); fclose(fp); if ((fp = fopen("TEST.DAT", "r")) == NULL) { perror("Open failed"); exit(0); } for(i = 0; i < 8; ++i) for(j = 0; j < 64; ++j) if((x = getc(fp)) != EOF) { c[i][j] = x; lengths[i] = j + 1; if(x == '\003') j = 63; nitems = i + 1; } else { if (j != 0) nitems = i + 1; i = 8; j = 63; } fclose(fp); printf("%d\n", nitems); for(i = 0; i < nitems; ++i) printf("%d\n", lengths[i]); } The above is the VMS version. For the unix version, just remove the string , "rfm=stmlf" from the first fopen() call. -------------------------------------------------------------------------------- Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL Disclaimer: Hey, I understand VAXen and VMS. That's what I get paid for. My understanding of astronomy is purely at the amateur level (or below). So unless what I'm saying is directly related to VAX/VMS, don't hold me or my organization responsible for it. If it IS related to VAX/VMS, you can try to hold me responsible for it, but my organization had nothing to do with it.