home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / oop / macapp3 / 551 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.8 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!applelink.apple.com
  2. From: ENS.CC@AppleLink.Apple.COM (ENS Computer Consulting,CAS)
  3. Newsgroups: comp.sys.mac.oop.macapp3
  4. Subject: Record -> Struct
  5. Message-ID: <727604925.3843109@AppleLink.Apple.COM>
  6. Date: 21 Jan 93 08:01:00 GMT
  7. Sender: daemon@Apple.COM
  8. Organization: AppleLink Gateway
  9. Lines: 48
  10.  
  11. Attn: MacApp3 Tech $
  12. SentBy: Paul Ens
  13.  
  14. Record -> Struct                                     1/18/93    3:32 PM
  15.  
  16. Hello all,
  17.  
  18. (I've been having problems with this message, my appologies to anyone who gets
  19. multiple copies.)
  20.  
  21. In a Pascal unit, I have the following record type, along with a function,
  22. returning me an "empty" record:
  23.  
  24.    AddressFormat = (None,HStApt,AptStH,LotBlock,LandLoc,Parcel);
  25.    Addr_Rec = RECORD
  26.        HNo : String[12];
  27.        Apt : String[7];
  28.        Street : String[30];
  29.        addrForm : AddressFormat;
  30.    END;
  31.  
  32. I want to convert this unit to C++ for use in both Pascal and C++ programs.
  33. So, I defined a struct as follows:
  34.  
  35.    enum AddressFormat { None, HStApt, AptStH, LotBlock, LandLoc, Parcel };
  36.    struct Addr_Rec
  37.    {
  38.        unsigned char   HNo[13], Apt[8], Street[31];
  39.        AddressFormat   addrForm;
  40.    };
  41.    typedef struct Addr_Rec Addr_Rec;
  42.  
  43. The problem comes when I want to write the function to return an empty one. I
  44. can't figure out how to make each field an empty Pascal string.
  45.  
  46. '(myRec)->HNo = "\p"' doesn't work. I get told that I can't assign a constant
  47. to a variable. I've tried using combinations of CStr255, but to no avail.
  48.  
  49. I know that I could set the proper byte to zero to get empty strings, but that
  50. won't help later when I want to set values to something specific.
  51.  
  52. Can someone let me in on the proper way to do this?
  53.  
  54. Thanks.
  55.  
  56. Paul Ens
  57. ENS Computer Consulting
  58.  
  59.