'fopen' successfully opens directories
Thomas Weber
thomas.weber.mail at gmail.com
Wed Apr 23 15:28:59 CDT 2008
On 23/04/08 07:58 -0700, Sergei Steshenko wrote:
> Hello,
>
> please see this:
>
> "
> GNU Octave, version 3.0.1b
> [snip]
> octave:1> fid = fopen("/tmp", "r")
> fid = 3
> octave:2> fread(fid, inf, "double")
> ans = [](0x1)
> "
>
> - I would expect failure, i.e. negative 'fid', from 'fopen' in such a case.
This behaviour is expected, see
http://www.opengroup.org/onlinepubs/009695399/functions/fopen.html
(look for EISDIR, which gives a hint that (f)opeing a directory is
considered valid, unless you want to write to it).
Whether this behavious is _useful_ is left to everyone's imagination.
Thomas
More information about the Bug-octave
mailing list