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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5686059903e2fca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-03 02:22:58 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: ada language Date: Tue, 3 Dec 2002 10:22:57 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <4f6087a5.0212030105.43712e2b@posting.google.com> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1038910977 23655 217.17.192.37 (3 Dec 2002 10:22:57 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Tue, 3 Dec 2002 10:22:57 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:31369 Date: 2002-12-03T10:22:57+00:00 List-Id: * satish umakar wrote: > how to convert a array of characters(characters stored in a array read > from a file) to a string type. The language defines: type String is array (Positive range <>) of Characters; So there is no difference between an array of Characters and a String, besides the String is a new type and the array is a different type. Therefore simply assign it, as long as the offsets does not cause a constraint problem: procedure t is type Array_of_Character is array (Integer range <>) of Character; a : Array_of_Character := (-3 => 'H', -2 => 'e', -1|0 => 'l', 1 => 'o'); b : constant Array_of_Character (1 .. a'Length) := a; s : String := String (b); begin null; end t; If the domains of the offset types do not overlap, you have a problem. You will even have a problem when copying takes to much time or ressources: procedure t is type Negative is new Integer range Integer'First .. -1; type Array_of_Character is array (Negative range <>) of Character; a : Array_of_Character := (-5 => 'H', -4 => 'e', -3|-2 => 'l', -1 => 'o'); s : String (1 .. a'Length); pragma Import (Ada, s); -- Suppress initialising. for s'Address use a'Address; -- Map array content. begin null; end t;