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,fbb7003b9d2e8c21 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-04 15:24:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!wn14eed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc02.POSTED!not-for-mail Message-ID: <3CD45E7D.2DA637B5@attbi.com> From: Mark Biggar X-Mailer: Mozilla 4.79 [en]C-{C-UDP; EBM-SONY1} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: how to read a file into a array??? References: <3CD430FE.B803914C@acm.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 12.235.88.57 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc02 1020551084 12.235.88.57 (Sat, 04 May 2002 22:24:44 GMT) NNTP-Posting-Date: Sat, 04 May 2002 22:24:44 GMT Organization: AT&T Broadband Date: Sat, 04 May 2002 22:24:44 GMT Xref: archiver1.google.com comp.lang.ada:23547 Date: 2002-05-04T22:24:44+00:00 List-Id: Jeffrey Carter wrote: > > devine wrote: > > > > I'm having some problems reading a file into a array. Say the file > > has the line > > This is a test, how can i read each word of the file into a array? an > > example would be helpful. > > thanks. > > An array object in Ada is always a fixed size, so you have to have some > means of deciding how big to make your array. Since words in a text file > are different sizes, you're going to have to have array components that > can handle different size components. Don't bother. Slurp the whole file into one big string and then parse and create an array of records containing indices to the first and last character of each word. Write an access function that takes an index and returns the corresponding slice. -- Mark Biggar mark.a.biggar@attbi.com