home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / vms / 20594 < prev    next >
Encoding:
Text File  |  1993-01-08  |  2.2 KB  |  67 lines

  1. Path: sparky!uunet!sunquest!spades.aces.com!gavron
  2. From: gavron@spades.aces.com (Ehud Gavron 602-570-2000 x. 2546)
  3. Newsgroups: comp.os.vms
  4. Subject: Re: RMS RAB & FAB for VAXC file
  5. Message-ID: <8JAN199310215940@spades.aces.com>
  6. Date: 8 Jan 93 17:21:00 GMT
  7. References: <C0Bwu6.F59@wm.estec.esa.nl> <1ijk8dINNs5m@gap.caltech.edu>
  8. Sender: news@sunquest.UUCP
  9. Reply-To: gavron@ACES.COM
  10. Organization: ACES Consulting Inc.
  11. Lines: 53
  12. News-Software: VAX/VMS VNEWS 1.4-b1
  13.  
  14. In article <1ijk8dINNs5m@gap.caltech.edu>, carl@SOL1.GPS.CALTECH.EDU writes...
  15. #In article <C0Bwu6.F59@wm.estec.esa.nl>, guy@wmsg02.wm.estec.esa.nl (Guy Brooker) writes:
  16. #>Coming back from my Christmas I have read a long discussion about VAX C
  17. #>buffer flushing. Many people say that it is easy to get the RAB/FABs from
  18. #>a VAX C FILE *
  19. #>
  20. #>OK so how do you do it ???
  21. ..
  22. #There's no such routine (at least under VMS v5.4-2
  23. #in the VAXC RTL), though Ehud had indicated that a perusal of the listings will
  24. #allow you to figure out how to find it.  Unfortunately, I don't have the
  25. #listings, and the contact for the CSLG here won't mount them except upon
  26. ..
  27.  
  28. Ok, I can take a hint.  The code below was shared with me by Jerry Leichter
  29. in early 1991, but still works today :)
  30.  
  31. #--------------------------------------------------------------------------------
  32. #Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL
  33.  
  34.     Ehud
  35.  
  36. --
  37. Ehud Gavron        (EG76)     
  38. gavron@aces.com
  39.  
  40. #include stdio
  41. #include rab;
  42. #include fab;
  43. #include nam;
  44. #define fcb_l_rab 0x0f4;    /* This offset might change depending on vms
  45.                                 version.  It works for 5.4. */
  46. struct FAB *fabptr;
  47. struct RAB *rabptr;
  48. struct NAM *namptr;
  49. FILE fp;
  50. int *mp;
  51. main()
  52. {
  53. int fn = 0;
  54. fp = fopen("stuff.dat","w");
  55. mp = fp;
  56. rabptr = *mp + fcb_l_rab;
  57. printf("RAB.BID = %x.RAB.BLN = %x. RAB.FAB = %x. \n",
  58.        rabptr->rab$b_bid,rabptr->rab$b_bln,rabptr->rab$l_fab);
  59. fabptr = rabptr->rab$l_fab;
  60. printf("FAB.BID = %x.FAB.BLN = %x. FAB.NAM = %x. \n",
  61.        fabptr->fab$b_bid,fabptr->fab$b_bln,fabptr->fab$l_nam);
  62. namptr = fabptr->fab$l_nam;
  63. printf("Per NAM block, file name string is %.*s. \n",
  64.        namptr->nam$b_rsl,namptr->nam$l_rsa);
  65. }
  66.