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,dcb81b5322bf4a6d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!cyclone1.gnilink.net!gnilink.net!wn14feed!worldnet.att.net!attbi_s02.POSTED!53ab2750!not-for-mail From: "Steve" Newsgroups: comp.lang.ada References: Subject: Re: Binding to feof 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 Message-ID: NNTP-Posting-Host: 24.21.42.251 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s02 1093659928 24.21.42.251 (Sat, 28 Aug 2004 02:25:28 GMT) NNTP-Posting-Date: Sat, 28 Aug 2004 02:25:28 GMT Organization: Comcast Online Date: Sat, 28 Aug 2004 02:25:32 GMT Xref: g2news1.google.com comp.lang.ada:3108 Date: 2004-08-28T02:25:32+00:00 List-Id: I just did a quick check on the "C" definition of feof: int feof(FILE *stream) It seems that the function requires a pointer to a stream. Is your "FILE" type defined as a pointer? Perhaps you need to have: function End_Of_File( File : access File_Handle := Standard_Input'Access ); Or something similar. Steve (The Duck) "Jeffrey Carter" wrote in message news:AvRXc.518$8d1.147@newsread2.news.pas.earthlink.net... > Jerry van Dijk wrote: > > > > If the binding is correct, it should work. Could you show an example > > of the code and how you use it ? > > function End_Of_File (File : File_Handle := Standard_Input) > return Boolean is > Result : Int; > > function C_EOF (File : File_Handle) return Int; > pragma Import (C, C_EOF, "feof"); > -- This seems to always return zero, even when at the EOF. > begin -- End_Of_File > Result := C_EOF (File); > > return Result /= 0; > end End_Of_File; > > Including debug statements indicates that Result is always zero. > > > I am not sure why you would want to do this though. If you want to > > use/interface to the C stream API, GNAT already provides a binding. > > If you are looking for the most efficient code, you need to use the > > Win32 file API, as the C API, on Windows, is itself also a binding to > > the Win32 API. > > None of the above. I don't want to use C streams, nor am I interested in > the most efficient code. I just want to experiment with text I/O that > doesn't count columns, lines, and pages, to see how it compares. > > -- > Jeff Carter > "Have you gone berserk? Can't you see that that man is a ni?" > Blazing Saddles > 38 >