From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Binding to feof
Date: Sat, 28 Aug 2004 02:25:32 GMT
Date: 2004-08-28T02:25:32+00:00 [thread overview]
Message-ID: <s2SXc.80415$mD.20157@attbi_s02> (raw)
In-Reply-To: AvRXc.518$8d1.147@newsread2.news.pas.earthlink.net
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" <spam@spam.com> 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
>
next prev parent reply other threads:[~2004-08-28 2:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-27 18:14 Binding to feof Jeffrey Carter
2004-08-27 21:07 ` Jerry van Dijk
2004-08-28 1:48 ` Jeffrey Carter
2004-08-28 2:25 ` Steve [this message]
2004-08-28 18:51 ` Jeffrey Carter
2004-08-28 10:26 ` Eric Jacoboni
2004-08-29 0:15 ` Keith Thompson
2004-08-30 6:56 ` Jeffrey Carter
2004-08-30 17:16 ` Hyman Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox