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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7bf23c8e794b6462 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!h48g2000cwc.googlegroups.com!not-for-mail From: "markww" Newsgroups: comp.lang.ada Subject: Re: STRING length Date: 14 Nov 2006 17:09:06 -0800 Organization: http://groups.google.com Message-ID: <1163552946.479495.27330@h48g2000cwc.googlegroups.com> References: <1163544675.070347.64490@h54g2000cwb.googlegroups.com> <1163543045.5361.12.camel@localhost.localdomain> <1163551453.005505.131470@h54g2000cwb.googlegroups.com> NNTP-Posting-Host: 68.174.181.181 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1163552951 12576 127.0.0.1 (15 Nov 2006 01:09:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 15 Nov 2006 01:09:11 +0000 (UTC) In-Reply-To: <1163551453.005505.131470@h54g2000cwb.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: h48g2000cwc.googlegroups.com; posting-host=68.174.181.181; posting-account=cNKOMg0AAADT2ug8oGSYYXo8bsDvrHzw Xref: g2news2.google.com comp.lang.ada:7459 Date: 2006-11-14T17:09:06-08:00 List-Id: Actually please disregard the previous post, I found I needed to with and use: Ada.Text_IO.Unbounded_IO So.. finally one compilation error remains, the actual call to my function: begin Add_Record("Mark", "555-555-5555", "123 main street"); end LinkList; the error is: expected private type "Ada.Strings.Unbounded.Unbounded_String" what does that mean? The problem is with calling the procedure, if I comment the call out compilation is successful. The procedure looks like: procedure Add_Record(strName : in UNBOUNDED_STRING; strPhone : in UNBOUNDED_STRING; strAddress : in UNBOUNDED_STRING) is Temp : CHAR_REC_POINT; begin Put(strName); New_Line; Put(strPhone); New_Line; Put(strAddress); New_Line; end Add_Record; I guess the compiler doesn't interpret a literal string as an unbounded_string? Thanks, Mark On Nov 14, 7:44 pm, "markww" wrote: > Thanks Georg, that looks to be exactly what I need. I do have a problem > '#including', or, 'withing' rather unbounded string. > Now the head of my source file looks like: > > with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings.Unbounded; > use Ada.Text_IO, Ada.Integer_Text_IO; > > which is alright but as soon as I try: > > use Ada.Strings.Unbounded; > > the compiler gives me a bunch of errors, it seems to conflict with > Text_IO / Integer_Text_IO? Seems like all my previous calls to Put() > now became invalid. I'm not familiar with Ada but with C++ and > understand namespace collisions, is the same thing going on here? > > Thanks > > On Nov 14, 5:24 pm, Georg Bauhaus wrote: > > > > > On Tue, 2006-11-14 at 14:51 -0800, markww wrote: > > > Hi, > > > > How does one use a variable length string in ada?You use variable length strings in Ada by declaring them > > to be of type UNBOUNDED_STRING which is defined in > > Ada.Strings.Unbounded. > > > type MY_RECORD is > > record > > Name: UNBOUNDED_STRING; > > Phone: UNBOUNDED_STRING; > > Address: UNBOUNDED_STRING; > > end record; > > > Given that Phone is likely to be limited in length, you > > could consider declaring the Phone component to be of > > type BOUNDED_STRING, which is a string type with a maximum length. > > Unlike STRING, objects of this type can have any number > > of characters up to the maximum. See Ada.Strings.Bounded. > > > Yet another use of strings is in nested scopes: If you need > > a string in just one place, e.g. temporarily, you can use > > a plain STRING as in > > > declare > > temp: constant STRING := some_string_returning_func(...); > > begin > > -- use temp > > end; > > > The point here is that the `temp` string variable takes > > its bound from the initialization. You can also make it a > > variable, if you need to write to string components. > > > Seehttp://en.wikibooks.org/wiki/Ada_Programming/Strings > > > -- Georg- Hide quoted text -- Show quoted text -