[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: read error
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 8 Nov 2011 18:11:30 -0200
> One ugly way is to close the file descriptor behind the standard C
> library's back. You could add a routine to your test harness that in
> effect performs
>
> close(fileno(file));
>
> It's ugly but it works.
It is ugly but it is simple :) And it seems to work!
But when I tested it and I saw the error message (Bad file descriptor),
I became even ashamed of my question. For my specific requirments,
simply opening the file in "write" mode would be enough :)
f = io.open("temp", "w")
print(f:read())
--> nil Bad file descriptor 9
Anyway, thanks for all the suggestions; there were sereval interesting
stuff there (and this specific one that reminded me of that kind of
error.)
-- Roberto