comp.lang.ada
 help / color / mirror / Atom feed
* [newbie] Need som feedback on code snip
@ 1999-10-22  0:00 Preben Randhol
  1999-10-22  0:00 ` Ted Dennison
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Preben Randhol @ 1999-10-22  0:00 UTC (permalink / raw)



I wondered if somebody could take a peep at the code snip below and
comment on it. It works, but is is the Right Way to do it or is there
a smarter way. I'm learning Ada95 on my own and could need some feedback
from somebody experienced with Ada.



-- Just a small test to see how I can change the content of a string
-- variable when I do not know the length of the new or old text.

with Text_IO; use Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

procedure myTest is
   Orig_Text : aliased Unbounded_String := To_Unbounded_String("Hello world!");
   type String_ptr is access all Unbounded_String;
   Text_pointer : String_ptr;

begin
   Put_Line(To_String(Orig_Text));
   Text_Pointer := Orig_Text'Access;
   Text_Pointer.all := To_Unbounded_String("Hello yourself!");
   Put_Line(To_String(Orig_Text));
end myTest;

Thanks in advance...

-- 
Preben Randhol                 Affliction is enamoured of thy parts, 
[randhol@pvv.org]              And thou art wedded to calamity. 
[http://www.pvv.org/~randhol/]                    -- W. Shakespeare 




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-10-24  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-22  0:00 [newbie] Need som feedback on code snip Preben Randhol
1999-10-22  0:00 ` Ted Dennison
1999-10-22  0:00   ` Ted Dennison
1999-10-22  0:00 ` [newbie] Need some " Matthew Heaney
1999-10-22  0:00 ` [newbie] Need som " Robert I. Eachus
1999-10-24  0:00   ` Preben Randhol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox