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,56e5e06428166864 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: problems with interfacing c Date: Fri, 28 Jan 2011 06:24:53 +0100 Organization: Ada @ Home Message-ID: References: <8b6a5b24-5ab0-4d38-9be8-86911aba7fcf@k22g2000yqh.googlegroups.com> <13d5wy5ni51xh$.xnhoi3uhm9ql.dlg@40tude.net> <85c958cc-8cd3-46be-b14d-3519ff207d87@b8g2000vbi.googlegroups.com> NNTP-Posting-Host: OjPmqUY/3zYGcdRaWOTU3g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/11.00 (Win32) Xref: g2news2.google.com comp.lang.ada:17731 Date: 2011-01-28T06:24:53+01:00 List-Id: Le Fri, 28 Jan 2011 01:39:50 +0100, Stoik = a = =C3=A9crit: > Thanks for your suggestions and comments. The point is that I am sendi= ng > a solution to a problem to a site managing programming contests, and t= he = > stdin > is in fact redirected to some text file with data. I do not know how > big the data file will be, I know only the upper limit. Quick reading = of = > the data is the key to success, and the two lines of C work very well = for > the purpose. I have not tried your solution, is it not going to cause > constraint_error when it meets the end of the file? Why not simply get the file size before reading its content ? You seem t= o = suggest you have to read from the file, not from the standard input = stream, so should be OK (that's a very strange contest this one=E2=80=A6= the = execution speed will more depend on runtime and platform than to your ar= t). > The other question is - how to use the C bindings properly in such a > case? For that purpose, there is no good way, because this is ... heuu... stup= id = (oops). There may be proper ways to bind to something else, not to this.= -- = Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es= t pas pour = les chiens. =E2=80=9CI am fluent in ASCII=E2=80=9D [Warren 2010]