neko.io.FileInput.eof()

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

neko.io.FileInput.eof()

Andreas Mokros
Hi.

neko.io.FileInput.eof() doesn't work?
Seems like a known issue:
http://haxe.org/doc/neko/fileio
suggests a try/catch workaround ...

--
Mockey

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: neko.io.FileInput.eof()

Nicolas Cannasse
Le 16/11/2011 17:14, Andreas Mokros a écrit :
> Hi.
>
> neko.io.FileInput.eof() doesn't work?
> Seems like a known issue:
> http://haxe.org/doc/neko/fileio
> suggests a try/catch workaround ...

It should work, not sure in which case it doesn't.
If you can send me a very very small reproducible example...

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: neko.io.FileInput.eof()

Andreas Mokros
Hi.

On Wed, 16 Nov 2011 17:30:32 +0100
Nicolas Cannasse <[hidden email]> wrote:
> It should work, not sure in which case it doesn't.
> If you can send me a very very small reproducible example...

class Test {
        static function main() {
                var file = neko.io.File.read("any file");
                while (true) {
                        trace (file.eof());
                        if (file.eof()) break;
                        var line = file.readLine();
                }
                file.close();
        }
}

eof() always returns false. readLine throws an exception after the last
line (Eof).
Neko 1.8.2 on Linux64.

--
Mockey

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: neko.io.FileInput.eof()

Ian Martins
I asked about this years ago and was told that it was always supposed to return false.  I noted that in the doc.


-Ian

On Wed, Nov 16, 2011 at 12:04 PM, Andreas Mokros <[hidden email]> wrote:
Hi.

On Wed, 16 Nov 2011 17:30:32 +0100
Nicolas Cannasse <[hidden email]> wrote:
> It should work, not sure in which case it doesn't.
> If you can send me a very very small reproducible example...

class Test {
       static function main() {
               var file = neko.io.File.read("any file");
               while (true) {
                       trace (file.eof());
                       if (file.eof()) break;
                       var line = file.readLine();
               }
               file.close();
       }
}

eof() always returns false. readLine throws an exception after the last
line (Eof).
Neko 1.8.2 on Linux64.

--
Mockey

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: neko.io.FileInput.eof()

Andreas Mokros
Hi.

On Wed, 16 Nov 2011 12:41:37 -0500
ian martins <[hidden email]> wrote:
> I asked about this years ago and was told that it was always supposed
> to return false.  I noted that in the doc.

Yeah, I saw this.
Well, if it's supposed to work with a try/catch block eof() is not
really necessary, is it?

--
Mockey

--
haXe - an open source web programming language
http://haxe.org