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 23:30:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!kibo.news.demon.net!news.demon.co.uk!demon!pogner.demon.co.uk!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: how to read a file into a array??? Date: 05 May 2002 07:20:10 +0100 Organization: Pushface Sender: simon@smaug Message-ID: References: <3CD430FE.B803914C@acm.org> <3CD45E7D.2DA637B5@attbi.com> NNTP-Posting-Host: pogner.demon.co.uk X-NNTP-Posting-Host: pogner.demon.co.uk:62.49.19.209 X-Trace: news.demon.co.uk 1020580144 nnrp-08:2440 NO-IDENT pogner.demon.co.uk:62.49.19.209 X-Complaints-To: abuse@demon.net User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Xref: archiver1.google.com comp.lang.ada:23555 Date: 2002-05-05T07:20:10+01:00 List-Id: Mark Biggar writes: > 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. This isn't a general solution, though; how long a string do you need? I suppose you could use file io operations, if your compiler provides them, to work out the length first .. it seems unwise to get into the habit of assuming a maximum size to whatever your input may be.