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,8dd8ee71ca4e5206 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-03 13:07:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news-out.cwix.com!newsfeed.cwix.com!newsfeed.icl.net!newsfeed.fjserv.net!news.teledanmark.no!newsfeed1.ulv.nextra.no!nextra.com!uio.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: Newbie question on Ada TExt_IO Date: Thu, 3 Oct 2002 20:07:22 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: <93d4dcd4.0210031020.b0cca2b@posting.google.com> NNTP-Posting-Host: kiuk0156.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1033675642 15984 129.241.83.82 (3 Oct 2002 20:07:22 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Thu, 3 Oct 2002 20:07:22 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:29504 Date: 2002-10-03T20:07:22+00:00 List-Id: On Thu, 3 Oct 2002 15:55:08 -0400, Matthew Heaney wrote: > > "Preben Randhol" wrote in message > news:slrnapp7f6.45u.randhol+news@kiuk0156.chembio.ntnu.no... >> >> No I would have used exceptions here. I find it difficult to see how you >> can avoid it. > > The issue is that if there's an error, the bad input doesn't get consumed. > You have to remember to call Skip_Line, so you might as well call Get_Line > instead. I don't understand, I did use Get_Line in my code. I can see a couple of problems though. I defined the String from only 1 to 80 so if you input a string above 80 characters it will be split. I also should have checked if the Last > 1 because one could give 1000 and the program would accept it as 1, but I left this for the reader :-) I wasn't refering to Get I was saying that I would use exceptions and I have a bit problems with seeing a solution where you do not have any exception handling when you expect user input. Or in other words if you are dealing with a human then expect exceptions ;-) -- Ada95 is good for you. http://libre.act-europe.fr/Software_Matters/02-C_pitfalls.pdf