From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,FILL_THIS_FORM, FILL_THIS_FORM_LONG,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,44594e18f15138a7,start X-Google-Attributes: gid103376,public From: David Morton Subject: String manipulation question Date: 1996/04/30 Message-ID: <318614BC.2DB3B88C@jinx.sckans.edu>#1/1 X-Deja-AN: 152274342 content-type: text/plain; charset=us-ascii organization: student mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (X11; I; Linux 1.3.81 i486) Date: 1996-04-30T00:00:00+00:00 List-Id: First, thanks to all who have replied to my previous two posts... Now I have a new problem. I'm making a database program (from scratch, to learn how) and need to put the fields in a file using direct_IO. As expected, Unbounded_Strings did not work with Direct_IO, as I assume Direct_IO needs an exact byte count of the record to find succesive records (makes sense). So for strings, I have to use a bounded string... for my purposes, let's say 1..20. Right now, I have to "mask" out the parts of the string that doesn't get used like so: type F_S_Flag is (Faculty, Student); type User_Record is record UName, Real_Name, Street_Address, City, State, Zip, Phone, Added, Deleted, Exit_Status, Comments : String(1..40); FS_Flag : F_S_Flag; end record; User_Record_Mask : User_Record := (" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", Student); Put("User Name: "); Get_Line(data.UName,Last); data.Uname(Last+1..data.Uname'Last) := User_Record_Mask.Uname(Last+1..User_Record_Mask.Uname'Last); this ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ seems messy, but it must be done in order to maintain the constant length. Null terminated strings would work, but isn't the implentation of it in Ada just as messy as this? (How would you implement it?) Thanks! -- David Morton mailto:dmorton@jinx.sckans.edu // If you use Netscape 2.0, 205 College, Winfield, KS 67156 // you can click on the mailto: part to reply! (HINT, HINT) :)