🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.oop.macapp3
Article #287

Record -> Struct

#287
From: ENS Computer Consulting,CAS
Date: Thu, 21 Jan 1993 08:01
48 lines
1888 bytes
Attn: MacApp3 Tech $
SentBy: Paul Ens
 
Record -> Struct                                     1/18/93    3:32 PM
 
Hello all,
 
(I've been having problems with this message, my appologies to anyone who gets
multiple copies.)
 
In a Pascal unit, I have the following record type, along with a function,
returning me an "empty" record:
 
   AddressFormat = (None,HStApt,AptStH,LotBlock,LandLoc,Parcel);
   Addr_Rec = RECORD
       HNo : String[12];
       Apt : String[7];
       Street : String[30];
       addrForm : AddressFormat;
   END;
 
I want to convert this unit to C++ for use in both Pascal and C++ programs.
So, I defined a struct as follows:
 
   enum AddressFormat { None, HStApt, AptStH, LotBlock, LandLoc, Parcel };
   struct Addr_Rec
   {
       unsigned char   HNo[13], Apt[8], Street[31];
       AddressFormat   addrForm;
   };
   typedef struct Addr_Rec Addr_Rec;
 
The problem comes when I want to write the function to return an empty one. I
can't figure out how to make each field an empty Pascal string.
 
'(myRec)->HNo = "\p"' doesn't work. I get told that I can't assign a constant
to a variable. I've tried using combinations of CStr255, but to no avail.
 
I know that I could set the proper byte to zero to get empty strings, but that
won't help later when I want to set values to something specific.
 
Can someone let me in on the proper way to do this?
 
Thanks.
 
Paul Ens
ENS Computer Consulting
 
Technical Details
Message-ID: <727604925.3843109@AppleLink.Apple.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!applelink.apple.com

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!applelink.apple.com
From: ENS.CC@AppleLink.Apple.COM (ENS Computer Consulting,CAS)
Newsgroups: comp.sys.mac.oop.macapp3
Subject: Record -> Struct
Message-ID: <727604925.3843109@AppleLink.Apple.COM>
Date: 21 Jan 93 08:01:00 GMT
Sender: daemon@Apple.COM
Organization: AppleLink Gateway
Lines: 48