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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a3fe2aac201210c0,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: "zork" Newsgroups: comp.lang.ada Subject: reading a text file into a string Date: Fri, 16 Jul 2004 03:27:57 +1000 Organization: - X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 220.245.100.34 X-Original-NNTP-Posting-Host: 220.245.100.34 Message-ID: <40f6bf21@dnews.tpgi.com.au> X-Trace: dnews.tpgi.com.au!tpg.com.au 1089912609 220.245.100.34 (16 Jul 2004 03:30:09 +1000) Path: g2news1.google.com!news1.google.com!newshub.sdsu.edu!logbridge.uoregon.edu!hammer.uoregon.edu!enews.sgi.com!news-peer-west.sprintlink.net!news.sprintlink.net!news-syd!dnews.tpgi.com.au!tpg.com.au!not-for-mail Xref: g2news1.google.com comp.lang.ada:2188 Date: 2004-07-16T03:27:57+10:00 List-Id: hi, i would like to read a whole text file into a string. I thought of using an unbounded_string for this: ---------- c, char: character; text : unbounded_string; ... -- read in text file while not end_of_file ( File ) loop Get ( File, c ); append ( text, c ); end loop; ... put ( to_string ( text ) ); -- display content of unbounded_string -- process text for i in 1 .. length ( text ) loop char := element ( text, i ); ... end loop; ----------- ... is this the general way of going about it? or is there a more prefered method of reading in a whole text file (into whatever format) for processing? Thanks again! cheers, zork