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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5afe598156615c8b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 06 Dec 2006 21:33:18 -0600 From: "Steve" Newsgroups: comp.lang.ada References: Subject: Re: Get_Line problem (GNAT bug?) Date: Wed, 6 Dec 2006 19:34:42 -0800 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-RFC2646: Format=Flowed; Response Message-ID: NNTP-Posting-Host: 24.20.111.245 X-Trace: sv3-PwHEb/rL7b1Zrge5xNA17NyQVBrRrOC2yzvWmsCrYLx+ja5/k1BO3SkHYYCgEiXAZyTLl4+OjQeu4kv!RTZE0D/ZK0B57B4zK6TrgIGjpvsHwjwzQF4lPYw8fuYsGovdZW5yehLNaoESTePVLQhf7gH0pa1P!XuGKKnK5gugbYQ== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:7839 Date: 2006-12-06T19:34:42-08:00 List-Id: "Maciej Sobczak" wrote in message news:el6jss$268$1@cernne03.cern.ch... [snip] > > Any thoughts? > You have run across what I consider to be a weakness in the standard Text_IO library, it is one of the few things I find really annoying about Ada, which I really like otherwise. In Ada you can't write a simple program to read and process lines in a text file that looks something like: while not End_Of_File( inFile ) loop Get_Line( inFile, Input_Buffer, Count ); Process_Line( Input_Buffer( 1 .. Count ) ); end loop; The problem is that Get_Line reads a line of text into a string buffer and returns the count of characters read. The "line of text" is defined by the next sequential characters from the current position of the file up to the next line terminator. If the last character in the file doesn't happen to be a line termnator an End_Error exception is raised. It would be much more useful if Get_Line read from the current position to the next line terminator OR end of file. This is the way the other languages I have used work. Because of the way the Get_Line function works you have to jump through a bunch of inefficient hoops like reading one character at a time in order to get the desired behavior. In my opinion raising an exception when the end of file doesn't have an end of line terminator should be the exceptional case and not the rule. I suspec this is the same problem you're running into with your interactive program. Steve (The Duck) > -- > Maciej Sobczak : http://www.msobczak.com/ > Programming : http://www.msobczak.com/prog/