comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Binding to feof
Date: Sat, 28 Aug 2004 01:48:16 GMT
Date: 2004-08-28T01:48:16+00:00	[thread overview]
Message-ID: <AvRXc.518$8d1.147@newsread2.news.pas.earthlink.net> (raw)
In-Reply-To: <uhdqocmsn.fsf@jvdsys.demon.nl>

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




  reply	other threads:[~2004-08-28  1:48 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 [this message]
2004-08-28  2:25     ` Steve
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